X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FQuery%2FSql%2FCondition.php;h=7f9351214d1e1474d146d4fe61007a326a12c105;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=00fe78c27f3d9c689d702d8e248f1d21897b00f2;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php b/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php index 00fe78c27..7f9351214 100644 --- a/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php +++ b/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php @@ -12,6 +12,13 @@ use Drupal\Core\Entity\Query\ConditionInterface; */ class Condition extends ConditionBase { + /** + * Whether this condition is nested inside an OR condition. + * + * @var bool + */ + protected $nestedInsideOrCondition = FALSE; + /** * The SQL entity query object this condition belongs to. * @@ -36,11 +43,12 @@ class Condition extends ConditionBase { $sql_condition = new SqlCondition($condition['field']->getConjunction()); // Add the SQL query to the object before calling this method again. $sql_condition->sqlQuery = $sql_query; + $condition['field']->nestedInsideOrCondition = $this->nestedInsideOrCondition || strtoupper($this->conjunction) === 'OR'; $condition['field']->compile($sql_condition); $conditionContainer->condition($sql_condition); } else { - $type = strtoupper($this->conjunction) == 'OR' || $condition['operator'] == 'IS NULL' ? 'LEFT' : 'INNER'; + $type = $this->nestedInsideOrCondition || strtoupper($this->conjunction) === 'OR' || $condition['operator'] === 'IS NULL' ? 'LEFT' : 'INNER'; $field = $tables->addField($condition['field'], $type, $condition['langcode']); $condition['real_field'] = $field; static::translateCondition($condition, $sql_query, $tables->isFieldCaseSensitive($condition['field']));