Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Database / Query / Select.php
index 61cb39731b3d7fa5b813d71f21ae3bafa5ece99f..fe88f84172873c05dd9ae233e68bd6b72b59f1b9 100644 (file)
@@ -828,7 +828,7 @@ class Select extends Query implements SelectInterface {
     $query .= implode(', ', $fields);
 
     // FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway.
-    $query .= "\nFROM ";
+    $query .= "\nFROM";
     foreach ($this->tables as $table) {
       $query .= "\n";
       if (isset($table['join type'])) {
@@ -914,6 +914,8 @@ class Select extends Query implements SelectInterface {
    * {@inheritdoc}
    */
   public function __clone() {
+    parent::__clone();
+
     // On cloning, also clone the dependent objects. However, we do not
     // want to clone the database connection object as that would duplicate the
     // connection itself.
@@ -923,6 +925,11 @@ class Select extends Query implements SelectInterface {
     foreach ($this->union as $key => $aggregate) {
       $this->union[$key]['query'] = clone($aggregate['query']);
     }
+    foreach ($this->tables as $alias => $table) {
+      if ($table['table'] instanceof SelectInterface) {
+        $this->tables[$alias]['table'] = clone $table['table'];
+      }
+    }
   }
 
 }