class Condition in Search API 8
Represents a single (field operator value) condition in a search query.
Hierarchy
- class \Drupal\search_api\Query\Condition implements ConditionInterface
Expanded class hierarchy of Condition
6 files declare their use of Condition
- AllTermsArgumentTest.php in tests/
src/ Unit/ Views/ AllTermsArgumentTest.php - FieldsProcessorPluginBaseTest.php in tests/
src/ Unit/ Processor/ FieldsProcessorPluginBaseTest.php - HtmlFilterTest.php in tests/
src/ Unit/ Processor/ HtmlFilterTest.php - IgnoreCaseTest.php in tests/
src/ Unit/ Processor/ IgnoreCaseTest.php - IgnoreCharacterTest.php in tests/
src/ Unit/ Processor/ IgnoreCharacterTest.php
File
- src/
Query/ Condition.php, line 8
Namespace
Drupal\search_api\QueryView source
class Condition implements ConditionInterface {
/**
* The field this condition checks.
*
* @var string
*/
protected $field;
/**
* The value being compared to the field.
*
* @var mixed
*/
protected $value;
/**
* The operator that combined field and value in this condition.
*
* @var string
*/
protected $operator;
/**
* Constructs a Condition object.
*
* @param string $field
* The field this condition checks.
* @param mixed $value
* The value being compared to the field.
* @param string $operator
* (optional) The operator that combined field and value in this condition.
*/
public function __construct($field, $value, $operator = '=') {
$this->field = $field;
$this->value = $value;
$this->operator = $operator;
}
/**
* {@inheritdoc}
*/
public function getField() {
return $this->field;
}
/**
* {@inheritdoc}
*/
public function setField($field) {
$this->field = $field;
return $this;
}
/**
* {@inheritdoc}
*/
public function getValue() {
return $this->value;
}
/**
* {@inheritdoc}
*/
public function setValue($value) {
$this->value = $value;
return $this;
}
/**
* {@inheritdoc}
*/
public function getOperator() {
return $this->operator;
}
/**
* {@inheritdoc}
*/
public function setOperator($operator) {
$this->operator = $operator;
return $this;
}
/**
* Implements the magic __toString() method to simplify debugging.
*/
public function __toString() {
return "{$this->field} {$this->operator} " . str_replace("\n", "\n ", var_export($this->value, TRUE));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Condition:: |
protected | property | The field this condition checks. | |
Condition:: |
protected | property | The operator that combined field and value in this condition. | |
Condition:: |
protected | property | The value being compared to the field. | |
Condition:: |
public | function |
Retrieves the field. Overrides ConditionInterface:: |
|
Condition:: |
public | function |
Retrieves the operator. Overrides ConditionInterface:: |
|
Condition:: |
public | function |
Retrieves the value. Overrides ConditionInterface:: |
|
Condition:: |
public | function |
Sets the field. Overrides ConditionInterface:: |
|
Condition:: |
public | function |
Sets the operator. Overrides ConditionInterface:: |
|
Condition:: |
public | function |
Sets the value. Overrides ConditionInterface:: |
|
Condition:: |
public | function | Constructs a Condition object. | |
Condition:: |
public | function | Implements the magic __toString() method to simplify debugging. |