class Criteria (View source)

Criteria for filtering Selectable collections.

Constants

ASC

DESC

Methods

static Criteria
create()

Creates an instance of the class.

expr()

Returns the expression builder.

__construct(Expression|null $expression = null, array|null $orderings = null, $firstResult = null, $maxResults = null)

Construct a new Criteria.

where(Expression $expression)

Sets the where expression to evaluate when this Criteria is searched for.

andWhere(Expression $expression)

Appends the where expression to evaluate when this Criteria is searched for using an AND with previous expression.

orWhere(Expression $expression)

Appends the where expression to evaluate when this Criteria is searched for using an OR with previous expression.

Expression|null
getWhereExpression()

Gets the expression attached to this Criteria.

string[]
getOrderings()

Gets the current orderings of this Criteria.

orderBy(array $orderings)

Sets the ordering of the result of this Criteria.

int|null
getFirstResult()

Gets the current first result option of this Criteria.

setFirstResult(int|null $firstResult)

Set the number of first result that this Criteria should return.

int|null
getMaxResults()

Gets maxResults.

setMaxResults(int|null $maxResults)

Sets maxResults.

Details

static Criteria create()

Creates an instance of the class.

Return Value

Criteria

static ExpressionBuilder expr()

Returns the expression builder.

Return Value

ExpressionBuilder

__construct(Expression|null $expression = null, array|null $orderings = null, $firstResult = null, $maxResults = null)

Construct a new Criteria.

Parameters

Expression|null $expression
array|null $orderings
$firstResult
$maxResults

Criteria where(Expression $expression)

Sets the where expression to evaluate when this Criteria is searched for.

Parameters

Expression $expression

Return Value

Criteria

Criteria andWhere(Expression $expression)

Appends the where expression to evaluate when this Criteria is searched for using an AND with previous expression.

Parameters

Expression $expression

Return Value

Criteria

Criteria orWhere(Expression $expression)

Appends the where expression to evaluate when this Criteria is searched for using an OR with previous expression.

Parameters

Expression $expression

Return Value

Criteria

Expression|null getWhereExpression()

Gets the expression attached to this Criteria.

Return Value

Expression|null

string[] getOrderings()

Gets the current orderings of this Criteria.

Return Value

string[]

Criteria orderBy(array $orderings)

Sets the ordering of the result of this Criteria.

Keys are field and values are the order, being either ASC or DESC.

Parameters

array $orderings

Return Value

Criteria

See also

Criteria::ASC
Criteria::DESC

int|null getFirstResult()

Gets the current first result option of this Criteria.

Return Value

int|null

Criteria setFirstResult(int|null $firstResult)

Set the number of first result that this Criteria should return.

Parameters

int|null $firstResult The value to set.

Return Value

Criteria

int|null getMaxResults()

Gets maxResults.

Return Value

int|null

Criteria setMaxResults(int|null $maxResults)

Sets maxResults.

Parameters

int|null $maxResults The value to set.

Return Value

Criteria