public function addPage($page) { parent::addPage($page); $this->pages = array(); }
/** * Sets parent container * * @param AbstractContainer $parent [optional] new parent to set. * Default is null which will set no parent. * @return AbstractPage fluent interface, returns self */ public function setParent(AbstractContainer $parent = null) { if ($parent === $this) { throw new Exception\InvalidArgumentException('A page cannot have itself as a parent'); } // return if the given parent already is parent if ($parent === $this->parent) { return $this; } // remove from old parent if (null !== $this->parent) { $this->parent->removePage($this); } // set new parent $this->parent = $parent; // add to parent if page and not already a child if (null !== $this->parent && !$this->parent->hasPage($this, false)) { $this->parent->addPage($this); } return $this; }