class EntityCondition (View source)

internal  JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
 

A condition object for the EntityQuery.

Constants

PATH_KEY

The field key in the filter condition: filter[lorem][condition][].

VALUE_KEY

The value key in the filter condition: filter[lorem][condition][].

OPERATOR_KEY

The operator key in the condition: filter[lorem][condition][].

Properties

static string[] $allowedOperators

The allowed condition operators.

protected string $field

The field to be evaluated.

protected string $operator

The condition operator.

protected mixed $value

The value against which the field should be evaluated.

Methods

__construct($field, $value, $operator = NULL)

Constructs a new EntityCondition object.

string
field()

The field to be evaluated.

string
operator()

The comparison operator to use for the evaluation.

mixed
value()

The value against which the condition should be evaluated.

static EntityCondition
createFromQueryParameter(mixed $parameter)

Creates an EntityCondition object from a query parameter.

static 
validate($parameter)

Validates the filter has the required fields.

Details

__construct($field, $value, $operator = NULL)

Constructs a new EntityCondition object.

Parameters

$field
$value
$operator

string field()

The field to be evaluated.

Return Value

string

The field upon which to evaluate the condition.

string operator()

The comparison operator to use for the evaluation.

For a list of allowed operators:

Return Value

string

The condition operator.

See also

EntityCondition::allowedOperators

mixed value()

The value against which the condition should be evaluated.

Return Value

mixed

The condition comparison value.

static EntityCondition createFromQueryParameter(mixed $parameter)

Creates an EntityCondition object from a query parameter.

Parameters

mixed $parameter

The filter[condition] query parameter from the request.

Return Value

EntityCondition

An EntityCondition object with defaults.

static protected validate($parameter)

Validates the filter has the required fields.

Parameters

$parameter