function SelectQuery::__clone

Overrides Query::__clone

File

includes/database/select.inc, line 1657

Class

SelectQuery
Query builder for SELECT statements.

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->where = clone $this->where;
    $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 SelectQueryInterface) {
            $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.