W3cubDocs

/Drupal 8

public function SelectExtender::__clone

public SelectExtender::__clone()

Clone magic method.

Select queries have dependent objects that must be deep-cloned. The connection object itself, however, should not be cloned as that would duplicate the connection itself.

Overrides SelectInterface::__clone

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 482

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function __clone() {
  $this->uniqueIdentifier = uniqid('', TRUE);

  // We need to deep-clone the query we're wrapping, which in turn may
  // deep-clone other objects.  Exciting!
  $this->query = clone($this->query);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Query!SelectExtender.php/function/SelectExtender::__clone/8.1.x