X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FDatabase%2FQuery%2FSelect.php;h=fe88f84172873c05dd9ae233e68bd6b72b59f1b9;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=61cb39731b3d7fa5b813d71f21ae3bafa5ece99f;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Database/Query/Select.php b/web/core/lib/Drupal/Core/Database/Query/Select.php index 61cb39731..fe88f8417 100644 --- a/web/core/lib/Drupal/Core/Database/Query/Select.php +++ b/web/core/lib/Drupal/Core/Database/Query/Select.php @@ -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']; + } + } } }