function clear() { foreach ($this->children as $c) { $c->parent = null; $c->delete(); } $this->children = array(); }