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