Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / src / Plugin / views / query / Sql.php
index 1210c1c72dfd056e927aa8f4f6f7abc77e217415..7df6521b1cbb5529f419f4954197c5b871d79ff1 100644 (file)
@@ -5,6 +5,7 @@ namespace Drupal\views\Plugin\views\query;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Database\Database;
+use Drupal\Core\Database\Query\Condition;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
@@ -60,6 +61,8 @@ class Sql extends QueryPluginBase {
   /**
    * The default operator to use when connecting the WHERE groups. May be
    * AND or OR.
+   *
+   * @var string
    */
   protected $groupOperator = 'AND';
 
@@ -81,9 +84,14 @@ class Sql extends QueryPluginBase {
 
   /**
    * A flag as to whether or not to make the primary field distinct.
+   *
+   * @var bool
    */
   public $distinct = FALSE;
 
+  /**
+   * @var bool
+   */
   protected $hasAggregate = FALSE;
 
   /**
@@ -830,7 +838,7 @@ class Sql extends QueryPluginBase {
    * @code
    * $this->query->addWhere(
    *   $this->options['group'],
-   *   db_or()
+   *   (new Condition('OR'))
    *     ->condition($field, $value, 'NOT IN')
    *     ->condition($field, $value, 'IS NULL')
    * );
@@ -1056,13 +1064,13 @@ class Sql extends QueryPluginBase {
     $has_arguments = FALSE;
     $has_filter = FALSE;
 
-    $main_group = db_and();
-    $filter_group = $this->groupOperator == 'OR' ? db_or() : db_and();
+    $main_group = new Condition('AND');
+    $filter_group = $this->groupOperator == 'OR' ? new Condition('OR') : new Condition('AND');
 
     foreach ($this->$where as $group => $info) {
 
       if (!empty($info['conditions'])) {
-        $sub_group = $info['type'] == 'OR' ? db_or() : db_and();
+        $sub_group = $info['type'] == 'OR' ? new Condition('OR') : new Condition('AND');
         foreach ($info['conditions'] as $clause) {
           if ($clause['operator'] == 'formula') {
             $has_condition = TRUE;
@@ -1468,7 +1476,7 @@ class Sql extends QueryPluginBase {
 
         // Setup the result row objects.
         $view->result = iterator_to_array($result);
-        array_walk($view->result, function(ResultRow $row, $index) {
+        array_walk($view->result, function (ResultRow $row, $index) {
           $row->index = $index;
         });