public function __clone() { // we need to clone some of the elements if ($this->elements) { foreach ($this->elements as $id => $el) { $el = clone $el; $this->elements[$id] = $el; $el->owner = $this; } } }