public function getPagePath($code) { $page = $this->pageRepository->findOneBy(['code' => $code]); if (!$page instanceof Page) { return $this->getDefaultLink($code); } if ($page->getRoute() === null) { return $this->getDefaultLink($code); } try { return $this->router->generate($page->getRoute()); } catch (RouteNotFoundException $e) { return $this->getDefaultLink($code); } }