class EntityCondition in JSON:API 8
Same name and namespace in other branches
- 8.2 src/Query/EntityCondition.php \Drupal\jsonapi\Query\EntityCondition
A condition object for the EntityQuery.
@internal
Hierarchy
- class \Drupal\jsonapi\Query\EntityCondition
Expanded class hierarchy of EntityCondition
5 files declare their use of EntityCondition
- EntityConditionNormalizer.php in src/
Normalizer/ EntityConditionNormalizer.php - EntityConditionNormalizerTest.php in tests/
src/ Kernel/ Normalizer/ EntityConditionNormalizerTest.php - EntityResourceTest.php in tests/
src/ Kernel/ Controller/ EntityResourceTest.php - FilterNormalizer.php in src/
Normalizer/ FilterNormalizer.php - TemporaryQueryGuard.php in src/
Access/ TemporaryQueryGuard.php
File
- src/
Query/ EntityCondition.php, line 10
Namespace
Drupal\jsonapi\QueryView source
class EntityCondition {
/**
* The allowed condition operators.
*
* @var string[]
*/
public static $allowedOperators = [
'=',
'<>',
'>',
'>=',
'<',
'<=',
'STARTS_WITH',
'CONTAINS',
'ENDS_WITH',
'IN',
'NOT IN',
'BETWEEN',
'NOT BETWEEN',
'IS NULL',
'IS NOT NULL',
];
/**
* The field to be evaluated.
*
* @var string
*/
protected $field;
/**
* The condition operator.
*
* @var string
*/
protected $operator;
/**
* The value against which the field should be evaluated.
*
* @var mixed
*/
protected $value;
/**
* Constructs a new EntityCondition object.
*/
public function __construct($field, $value, $operator = NULL) {
$this->field = $field;
$this->value = $value;
$this->operator = $operator ? $operator : '=';
}
/**
* The field to be evaluated.
*
* @return string
* The field upon which to evaluate the condition.
*/
public function field() {
return $this->field;
}
/**
* The comparison operator to use for the evaluation.
*
* For a list of allowed operators:
*
* @see \Drupal\jsonapi\Query\EntityCondition::allowedOperators
*
* @return string
* The condition operator.
*/
public function operator() {
return $this->operator;
}
/**
* The value against which the condition should be evaluated.
*
* @return mixed
* The condition comparison value.
*/
public function value() {
return $this->value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityCondition:: |
public static | property | The allowed condition operators. | |
EntityCondition:: |
protected | property | The field to be evaluated. | |
EntityCondition:: |
protected | property | The condition operator. | |
EntityCondition:: |
protected | property | The value against which the field should be evaluated. | |
EntityCondition:: |
public | function | The field to be evaluated. | |
EntityCondition:: |
public | function | The comparison operator to use for the evaluation. | |
EntityCondition:: |
public | function | The value against which the condition should be evaluated. | |
EntityCondition:: |
public | function | Constructs a new EntityCondition object. |