Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseCondition::__clone

PHP magic __clone() method.

Only copies fields that implement QueryConditionInterface. Also sets $this->changed to TRUE.

File

includes/database/query.inc, line 1944

Class

DatabaseCondition
Generic class for a series of conditions in a query.

Code

function __clone() {
 $this->changed  = TRUE;
 foreach ($this->conditions  as $key => $condition) {
 if ($key !== '#conjunction') {
 if ($condition['field'] instanceof QueryConditionInterface) {
 $this->conditions [$key]['field'] = clone $condition['field'];
 }
 if ($condition['value'] instanceof SelectQueryInterface) {
 $this->conditions [$key]['value'] = clone $condition['value'];
 }
 }
 }
}

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