function Select::__clone

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__clone()
  2. 10 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__clone()
  3. 11.x core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__clone()

Overrides Query::__clone

File

core/lib/Drupal/Core/Database/Query/Select.php, line 930

Class

Select
Query builder for SELECT statements.

Namespace

Drupal\Core\Database\Query

Code

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.
    $this->condition = clone $this->condition;
    $this->having = clone $this->having;
    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'];
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.