You are here

public function ConditionAggregateBase::condition in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Query/ConditionAggregateBase.php \Drupal\Core\Entity\Query\ConditionAggregateBase::condition()
  2. 9 core/lib/Drupal/Core/Entity/Query/ConditionAggregateBase.php \Drupal\Core\Entity\Query\ConditionAggregateBase::condition()

Adds a condition.

Parameters

string|ConditionAggregateInterface $field: The field.

string $function: (optional) The function.

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 The called object.

Overrides ConditionAggregateInterface::condition

See also

\Drupal\Core\Entity\Query\QueryInterface::condition()

File

core/lib/Drupal/Core/Entity/Query/ConditionAggregateBase.php, line 13

Class

ConditionAggregateBase
Defines a common base class for all aggregation entity condition implementations.

Namespace

Drupal\Core\Entity\Query

Code

public function condition($field, $function = NULL, $value = NULL, $operator = NULL, $langcode = NULL) {
  $this->conditions[] = [
    'field' => $field,
    'function' => $function,
    'value' => $value,
    'operator' => $operator,
    'langcode' => $langcode,
  ];
  return $this;
}