interface ConditionInterface (View source)

Defines the entity query condition interface.

Methods

string
getConjunction()

Gets the current conjunction.

count()

Implements \Countable::count().

$this
condition(string|ConditionInterface $field, mixed $value = NULL, string $operator = NULL, string $langcode = NULL)

Adds a condition.

$this
exists(string $field, string $langcode = NULL)

Queries for the existence of a field.

$this
notExists(string $field, string $langcode = NULL)

Queries for the nonexistence of a field.

array
conditions()

Gets a complete list of all conditions in this conditional clause.

compile($query)

Compiles this conditional clause.

Details

string getConjunction()

Gets the current conjunction.

Return Value

string

Can be AND or OR.

count()

Implements \Countable::count().

Returns the size of this conditional. The size of the conditional is the size of its conditional array.

$this condition(string|ConditionInterface $field, mixed $value = NULL, string $operator = NULL, string $langcode = NULL)

Adds a condition.

Parameters

string|ConditionInterface $field

The field.

mixed $value

(optional) The value.

string $operator

(optional) The operator.

string $langcode

(optional) For which language the entity should be prepared, defaults to the current content language.

Return Value

$this

See also

QueryInterface::condition

$this exists(string $field, string $langcode = NULL)

Queries for the existence of a field.

Parameters

string $field

The field to query for existence.

string $langcode

(optional) For which language the entity should be prepared, defaults to the current content language.

Return Value

$this

See also

QueryInterface::exists

$this notExists(string $field, string $langcode = NULL)

Queries for the nonexistence of a field.

Parameters

string $field

The field to query for nonexistence.

string $langcode

(optional) For which language the entity should be prepared, defaults to the current content language.

Return Value

$this

See also

QueryInterface::notExists

array conditions()

Gets a complete list of all conditions in this conditional clause.

This method returns by reference. That allows alter hooks to access the data structure directly and manipulate it before it gets compiled.

Return Value

array

compile($query)

Compiles this conditional clause.

Parameters

$query

The query object this conditional clause belongs to.