diff --git c/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php w/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php index db08a61..e7e9e55 100644 --- c/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php +++ w/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php @@ -810,7 +810,7 @@ public function clearFields() { * @code * $this->query->addWhere( * $this->options['group'], - * db_or() + * $this->query->orConditionGroup() * ->condition($field, $value, 'NOT IN') * ->condition($field, $value, 'IS NULL') * ); @@ -1013,21 +1013,23 @@ function placeholder($base = 'views') { * There is other code in filters which makes sure that the group IDs are * higher than zero. * + * @param $query + * query object. * @param $where * 'where' or 'having'. */ - protected function buildCondition($where = 'where') { + protected function buildCondition($query, $where = 'where') { $has_condition = FALSE; $has_arguments = FALSE; $has_filter = FALSE; - $main_group = db_and(); - $filter_group = $this->group_operator == 'OR' ? db_or() : db_and(); + $main_group = $query->andConditionGroup(); + $filter_group = $this->group_operator == 'OR' ? $query->orConditionGroup() : $query->andConditionGroup(); foreach ($this->$where as $group => $info) { if (!empty($info['conditions'])) { - $sub_group = $info['type'] == 'OR' ? db_or() : db_and(); + $sub_group = $info['type'] == 'OR' ? $query->orConditionGroup() : $query->andConditionGroup(); foreach ($info['conditions'] as $clause) { // DBTNG doesn't support to add the same subquery twice to the main // query and the count query, so clone the subquery to have two instances @@ -1272,7 +1274,7 @@ public function query($get_count = FALSE) { foreach ($groupby as $field) { $query->groupBy($field); } - if (!empty($this->having) && $condition = $this->buildCondition('having')) { + if (!empty($this->having) && $condition = $this->buildCondition($query, 'having')) { $query->havingCondition($condition); } } @@ -1291,7 +1293,7 @@ public function query($get_count = FALSE) { } } - if (!empty($this->where) && $condition = $this->buildCondition('where')) { + if (!empty($this->where) && $condition = $this->buildCondition($query, 'where')) { $query->condition($condition); }