You are browsing a version that is no longer maintained. |
Expressions
The Doctrine\Common\Collections\Expr\Comparison
class
can be used to create comparison expressions to be used with the
Doctrine\Common\Collections\Criteria
class. It has the
following operator constants:
Comparison::EQ
Comparison::NEQ
Comparison::LT
Comparison::LTE
Comparison::GT
Comparison::GTE
Comparison::IS
Comparison::IN
Comparison::NIN
Comparison::CONTAINS
Comparison::MEMBER_OF
Comparison::STARTS_WITH
Comparison::ENDS_WITH
The Doctrine\Common\Collections\Expr\CompositeExpression
class
can be used to create composite expressions to be used with the
Doctrine\Common\Collections\Criteria
class. It has the
following operator constants:
CompositeExpression::TYPE_AND
CompositeExpression::TYPE_OR
CompositeExpression::TYPE_NOT
When using the TYPE_OR
and TYPE_AND
operators the
CompositeExpression
accepts multiple expressions as parameter
but only one expression can be provided when using the NOT
operator.
The Doctrine\Common\Collections\Criteria
class has the following
API to be used with expressions:
andWhere
Appends the where expression to evaluate when this Criteria is searched for using an AND with previous expression.
orWhere
Appends the where expression to evaluate when this Criteria is searched for using an OR with previous expression.
orderBy
Sets the ordering of the result of this Criteria.
1 $criteria->orderBy(['name' => Criteria::ASC]);
setFirstResult
Set the number of first result that this Criteria should return.
1 $criteria->setFirstResult(0);