public function Condition::compile in CiviCRM Entity 8.3
Compiles this conditional clause.
Parameters
$query: The query object this conditional clause belongs to.
Overrides ConditionInterface::compile
File
- src/
Entity/ Query/ CiviCRM/ Condition.php, line 23
Class
- Condition
- Implements entity query conditions for CiviCRM.
Namespace
Drupal\civicrm_entity\Entity\Query\CiviCRMCode
public function compile($condition_container) {
// If this is not the top level condition group then the sql query is
// added to the $conditionContainer object by this function itself. The
// SQL query object is only necessary to pass to Query::addField() so it
// can join tables as necessary. On the other hand, conditions need to be
// added to the $conditionContainer object to keep grouping.
foreach ($this->conditions as $condition) {
if ($condition['field'] instanceof ConditionInterface) {
$query_condition = new static('AND', $this->query);
$query_condition
->compile($condition_container);
}
else {
$condition_container
->setParameter($condition['field'], $condition['value']);
}
}
}