class ConditionFundamentals
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php \Drupal\Core\Entity\Query\ConditionFundamentals
- 10 core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php \Drupal\Core\Entity\Query\ConditionFundamentals
- 11.x core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php \Drupal\Core\Entity\Query\ConditionFundamentals
Common code for all implementations of the entity query condition interfaces.
Hierarchy
- class \Drupal\Core\Entity\Query\ConditionFundamentals
Expanded class hierarchy of ConditionFundamentals
File
-
core/
lib/ Drupal/ Core/ Entity/ Query/ ConditionFundamentals.php, line 8
Namespace
Drupal\Core\Entity\QueryView source
abstract class ConditionFundamentals {
/**
* Array of conditions.
*
* @var array
*/
protected $conditions = [];
/**
* The conjunction of this condition group. The value is one of the following:
*
* - AND (default)
* - OR
*
* @var string
*/
protected $conjunction;
/**
* The query this condition belongs to.
*
* @var \Drupal\Core\Entity\Query\QueryInterface
*/
protected $query;
/**
* List of potential namespaces of the classes belonging to this condition.
*
* @var array
*/
protected $namespaces = [];
/**
* Constructs a Condition object.
*
* @param string $conjunction
* The operator to use to combine conditions: 'AND' or 'OR'.
* @param QueryInterface $query
* The entity query this condition belongs to.
* @param array $namespaces
* List of potential namespaces of the classes belonging to this condition.
*/
public function __construct($conjunction, QueryInterface $query, $namespaces = []) {
$this->conjunction = $conjunction;
$this->query = $query;
$this->namespaces = $namespaces;
}
/**
* {@inheritdoc}
*/
public function getConjunction() {
return $this->conjunction;
}
/**
* {@inheritdoc}
*/
public function count() {
return count($this->conditions);
}
/**
* {@inheritdoc}
*/
public function &conditions() {
return $this->conditions;
}
/**
* Implements the magic __clone function.
*
* Makes sure condition groups are cloned as well.
*/
public function __clone() {
foreach ($this->conditions as $key => $condition) {
if ($condition['field'] instanceof ConditionInterface) {
$this->conditions[$key]['field'] = clone $condition['field'];
}
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
ConditionFundamentals::$conditions | protected | property | Array of conditions. | |
ConditionFundamentals::$conjunction | protected | property | The conjunction of this condition group. The value is one of the following: | |
ConditionFundamentals::$namespaces | protected | property | List of potential namespaces of the classes belonging to this condition. | |
ConditionFundamentals::$query | protected | property | The query this condition belongs to. | 1 |
ConditionFundamentals::conditions | public | function | ||
ConditionFundamentals::count | public | function | ||
ConditionFundamentals::getConjunction | public | function | ||
ConditionFundamentals::__clone | public | function | Implements the magic __clone function. | |
ConditionFundamentals::__construct | public | function | Constructs a Condition object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.