Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function indexAction($slug) |
||
21 | { |
||
22 | $slug = strtolower($slug); |
||
23 | $this->setMenu(MNU_START); |
||
24 | |||
25 | $repository = $this->getDoctrine()->getRepository('AppBundle:PageGroup'); |
||
26 | $pageBlocksQueryBuilder = $repository->getPageBlocksBySlugQueryBuilder( |
||
27 | $slug, |
||
28 | 'pageGroup.active = 1 AND pageBlocks.active = 1' |
||
29 | ); |
||
30 | |||
31 | /** @var PageGroup $pageGroup */ |
||
32 | $pageGroup = $pageBlocksQueryBuilder->getQuery()->getOneOrNullResult(); |
||
33 | |||
34 | if (!$pageGroup || $pageGroup->getPageBlocks()->count() === 0) { |
||
35 | throw $this->createNotFoundException('Page not found.'); |
||
36 | } |
||
37 | |||
38 | return $this->render('@App/Pages/index.html.twig', [ |
||
39 | 'pageGroup' => $pageGroup |
||
40 | ]); |
||
41 | } |
||
42 | |||
44 |