/** * @param ServiceLocatorInterface $serviceLocator * * @return \Zend\Navigation\Navigation */ public function createService(ServiceLocatorInterface $serviceLocator) { $this->rcmUserService = $serviceLocator->get('RcmUser\\Service\\RcmUserService'); $this->cmsPermissionChecks = $serviceLocator->get('Rcm\\Acl\\CmsPermissionsChecks'); $this->currentSite = $serviceLocator->get('Rcm\\Service\\CurrentSite'); $config = $serviceLocator->get('config'); /** @var \Doctrine\ORM\EntityManagerInterface $entityManager */ $entityManager = $serviceLocator->get('Doctrine\\ORM\\EntityManager'); /** @var \Rcm\Repository\Page $pageRepo */ $this->pageRepo = $entityManager->getRepository('\\Rcm\\Entity\\Page'); $application = $serviceLocator->get('Application'); /** @var RouteMatch $routeMatch */ $routeMatch = $application->getMvcEvent()->getRouteMatch(); if (!in_array($routeMatch->getMatchedRouteName(), $config['Rcm']['RcmCmsPageRouteNames'])) { return parent::createService($serviceLocator); } $pageMatch = $routeMatch->getParam('page', 'index'); if ($pageMatch instanceof Page) { $pageMatch = $pageMatch->getName(); } $this->pageRevision = $routeMatch->getParam('revision', null); $pageTypeMatch = $routeMatch->getParam('pageType', 'n'); if (!empty($pageMatch)) { $this->page = $this->pageRepo->findOneBy(['name' => $pageMatch, 'pageType' => $pageTypeMatch]); } return parent::createService($serviceLocator); }
public function createService(ServiceLocatorInterface $serviceLocator) { $this->siteService = $serviceLocator->get('Application\\Service\\SiteServiceInterface'); $this->utilityService = $serviceLocator->get('Application\\Service\\UtilityServiceInterface'); return parent::createService($serviceLocator); }