1 query.inc public DatabaseCondition::__clone()

PHP magic __clone() method.

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

File

core/includes/database/query.inc, line 1961
Non-specific Database query code. Used by all engines.

Class

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

Code

public 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']);
      }
    }
  }
}