Conditions | 3 |
Paths | 3 |
Total Lines | 32 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function indexAction($slug) |
||
26 | { |
||
27 | $slug = strtolower($slug); |
||
28 | $this->setMenu(MNU_START); |
||
29 | |||
30 | $pageService = $this->get('oc.page.page_service'); |
||
31 | $blockService = $this->get('oc.page.block_service'); |
||
32 | |||
33 | $page = $pageService->fetchOneBy([ |
||
34 | 'slug' => $slug, |
||
35 | 'active' => 1 |
||
36 | ]); |
||
37 | |||
38 | if (!$page) { |
||
39 | throw $this->createNotFoundException(); |
||
40 | } |
||
41 | |||
42 | $pageBlocks = $blockService->fetchBy([ |
||
43 | 'page_id' => $page->id, |
||
44 | 'locale' => $this->getGlobalContext()->getLocale(), |
||
45 | 'active' => 1 |
||
46 | ]); |
||
47 | |||
48 | if (count($pageBlocks) === 0) { |
||
49 | return $this->render('@App/Page/fallback.html.twig'); |
||
50 | } |
||
51 | |||
52 | return $this->render('@App/Page/index.html.twig', [ |
||
53 | 'page' => $page, |
||
54 | 'pageBlocks' => $pageBlocks |
||
55 | ]); |
||
56 | } |
||
57 | |||
61 |