class ClosureExpressionVisitor extends ExpressionVisitor (View source)

Walks an expression graph and turns it into a PHP closure.

This closure can be used with {@Collection#filter()} and is used internally by {@ArrayCollection#select()}.

Methods

mixed
walkComparison(Comparison $comparison)

Converts a comparison expression into the target query language output.

mixed
walkValue(Value $value)

Converts a value expression into the target query language part.

mixed
walkCompositeExpression(CompositeExpression $expr)

Converts a composite expression into the target query language output.

mixed
dispatch(Expression $expr)

Dispatches walking an expression to the appropriate handler.

static mixed
getObjectFieldValue(object|array $object, string $field)

Accesses the field of a given object. This field has to be public directly or indirectly (through an accessor get*, is*, or a magic method, __get, __call).

static Closure
sortByField($name, $orientation = 1, Closure|null $next = null)

Helper for sorting arrays of objects based on multiple fields + orientations.

Details

mixed walkComparison(Comparison $comparison)

Converts a comparison expression into the target query language output.

Parameters

Comparison $comparison

Return Value

mixed

mixed walkValue(Value $value)

Converts a value expression into the target query language part.

Parameters

Value $value

Return Value

mixed

mixed walkCompositeExpression(CompositeExpression $expr)

Converts a composite expression into the target query language output.

Parameters

CompositeExpression $expr

Return Value

mixed

mixed dispatch(Expression $expr)

Dispatches walking an expression to the appropriate handler.

Parameters

Expression $expr

Return Value

mixed

Exceptions

RuntimeException

static mixed getObjectFieldValue(object|array $object, string $field)

Accesses the field of a given object. This field has to be public directly or indirectly (through an accessor get*, is*, or a magic method, __get, __call).

Parameters

object|array $object
string $field

Return Value

mixed

static Closure sortByField($name, $orientation = 1, Closure|null $next = null)

Helper for sorting arrays of objects based on multiple fields + orientations.

Parameters

$name
$orientation
Closure|null $next

Return Value

Closure