You are here

public function ConditionBase::condition in Drupal 8

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

Adds a condition.

Parameters

string|\Drupal\Core\Entity\Query\ConditionInterface $field:

mixed $value:

string $operator:

string $langcode:

Return value

$this

Overrides ConditionInterface::condition

See also

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

6 calls to ConditionBase::condition()
Condition::exists in core/lib/Drupal/Core/Config/Entity/Query/Condition.php
Queries for the existence of a field.
Condition::exists in core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
Queries for the existence of a field.
Condition::exists in core/lib/Drupal/Core/Entity/Query/Null/Condition.php
Queries for the existence of a field.
Condition::notExists in core/lib/Drupal/Core/Config/Entity/Query/Condition.php
Queries for the nonexistence of a field.
Condition::notExists in core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
Queries for the nonexistence of a field.

... See full list

File

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

Class

ConditionBase
Defines a common base class for all entity condition implementations.

Namespace

Drupal\Core\Entity\Query

Code

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