Class

eZ\Publish\API\Repository\Values\Content\Query\Criterion\Field

class Field extends Criterion implements CriterionInterface, CustomFieldInterface

The Field Criterion class.

Provides content filtering based on Fields contents & values.

Properties

string $operator The operator used by the Criterion.
array(int|string) $value The value(s) matched by the criteria.
string $target The target used by the criteria (field, metadata...).
Value $valueData Additional value data, required by some criterions, MapLocationDistance for instance.

Methods

__construct(string|null $target, string|null $operator, string[]|int[]|int|string $value, Value $valueData = null)

Performs operator validation based on the Criterion specifications returned by {see getSpecifications()}.

from Criterion
static  createFromQueryBuilder($target, $operator, $value)

from Criterion
Specifications[] getSpecifications()

Criterion description function.

setCustomField(string $type, string $field, string $customField)

Set a custom field to query.

mixed getCustomField(string $type, string $field)

Return custom field.

Details

in Criterion at line 60
public __construct(string|null $target, string|null $operator, string[]|int[]|int|string $value, Value $valueData = null)

Performs operator validation based on the Criterion specifications returned by {see getSpecifications()}.

Parameters

string|null $target The target the Criterion applies to: metadata identifier, field identifier...
string|null $operator The operator the Criterion uses. If null is given, will default to Operator::IN if $value is an array, Operator::EQ if it is not.
string[]|int[]|int|string $value
Value $valueData

Exceptions

InvalidArgumentException if the provided operator isn't supported

in Criterion at line 149
static public createFromQueryBuilder($target, $operator, $value)

Parameters

$target
$operator
$value

at line 30
public Specifications[] getSpecifications()

Criterion description function.

Returns the combination of the Criterion's supported operator/value, as an array of eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications objects - Operator is one supported Operator, as an Operator::* constant - ValueType is the type of input value this operator requires, either array or single - SupportedTypes is an array of types the operator will accept - ValueCountLimitation is an integer saying how many values are expected.

// IN and EQ are supported return array( // The EQ operator expects a single value, either as an integer or a string new Specifications( Operator::EQ, Specifications::INPUTTYPESINGLE, array( Specifications::INPUTVALUEINTEGER, Specifications::INPUTVALUESTRING ), ), // The IN operator expects an array of values, of either integers or strings new Specifications( Operator::IN, Specifications::INPUTTYPEARRAY, array( Specifications::INPUTVALUEINTEGER, Specifications::INPUTVALUESTRING ) ) )*

Return Value

Specifications[]

at line 54
public setCustomField(string $type, string $field, string $customField)

Set a custom field to query.

Set a custom field to query for a defined field in a defined type.

Parameters

string $type
string $field
string $customField

at line 69
public mixed getCustomField(string $type, string $field)

Return custom field.

If no custom field is set, return null

Parameters

string $type
string $field

Return Value

mixed If no custom field is set, return null