public function loadPage(MvcEvent $e) { $routeMatch = $e->getRouteMatch(); $pageId = $routeMatch->getParam('page-id', null); if (null === $pageId) { return; } $page = $this->pageService->find($pageId); if (!$page instanceof Page) { throw new Exception\PageNotFoundException(sprintf('The page could not be found with id %s', $pageId)); } $event = new Event(__FUNCTION__, $this, array('page' => $page)); $this->events->trigger($event); $e->setParam('page', $page); }
public function getPageCollection() { if ($this->pageCollection instanceof PageCollection) { return $this->pageCollection; } $pages = $this->pageService->getTree(); if (!$pages instanceof PageCollection) { throw new Exception\PageNotFoundException('Collection not found'); } $this->pageCollection = $pages; return $this->pageCollection; }