Doctrine ExpressionBuilder and Expr

andX($arg1, $arg2, ...)
Multiple arguments AND
orX($arg1, $arg2, ...)
Multiple arguments OR
[n]eq($field, $value)
[Not] Equal
gte
Greater than [or equal]
lte
Less than [or equal]
isNull($field)
Is Null
[not]in($field, array $values)
[not] In
memberOf($field, $value)
ExpressionBuilder only Member of
isMemberOf($field, $value)
Expr only Member of
isNotNull($field)
Expr only Is not Null
between($field, $x, $y)
Expr only Between $x and $y
trim($field)
Expr only Trim
concat($x, $y)
Expr only Concat
literal($string)
Expr only Literal
lower($field)
Expr only Lower case
upper($field)
Expr only Upper case
count($field)
Expr only count
# Doctrine Expr #
Criteria::expr()->orX(
Criteria::expr()->eq('id', $facilityId),
Criteria::expr()->eq('active', TRUE)
);

# Doctrine ExpressionBuilder #
$qb = $this->createQueryBuilder('f');

$qb->where($qb->expr()->eq('id', '?arg1'))
->setParameter('arg1', $facilityId);

$qb->select($qb->expr()->substring('o.orderNumber', 4, 3));

$qb->select($qb->expr()->concat('p1.surname', $qb->expr()->literal(','), 'p1.firstName');
Comments