/** * Sets the section for this page. * * @param Section $section * * @return Page */ public function setSection(Section $section) { if ($section !== $this->_mainsection) { $this->_mainsection = null; $this->_level = $section->getLevel() + 1; if (0 === $this->_position) { $this->_position = 1; } } $this->_section = $section; return $this; }