src/Controller/PageController.php line 86

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Contenu\Page;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  9. /**
  10.  * Class PageController
  11.  * @package App\Controller
  12.  */
  13. class PageController extends AbstractController
  14. {
  15.     /**
  16.      * @Route("/protection-des-donnees", name="page.confidentialite", defaults={"seoEntity" = "Contenu\Page", "id" : Page::PAGE_CONFIDENTIALITE})
  17.      * @ParamConverter("page", class="App:Contenu\Page", options={"repository_method"="findById", "map_method_signature" = true})
  18.      * @return Response
  19.      */
  20.     /*public function confidentialite(Page $page): Response
  21.     {
  22.         return $this->render('page/detail.html.twig', [
  23.             'page' => $page,
  24.         ]);
  25.     }*/
  26.     /**
  27.      * @Route("/mentions-legales", name="page.mentions", defaults={"seoEntity" = "Contenu\Page", "id" : Page::PAGE_MENTIONS})
  28.      * @ParamConverter("page", class="App:Contenu\Page", options={"repository_method"="findById", "map_method_signature" = true})
  29.      * @return Response
  30.      */
  31.     /*public function mentionsAction(Page $page): Response
  32.     {
  33.         return $this->render('page/detail.html.twig', [
  34.             'page' => $page,
  35.         ]);
  36.     }*/
  37.     /**
  38.      * @Route("/contact", name="page.contact", defaults={"seoEntity" = "Contenu\Page", "id" : Page::PAGE_CONTACT})
  39.      * @ParamConverter("page", class="App:Contenu\Page", options={"repository_method"="findById", "map_method_signature" = true})
  40.      * @return Response
  41.      */
  42.     public function contactAction(Page $page): Response
  43.     {
  44.         if (false === $page->getVisible()) {
  45.             throw $this->createNotFoundException('La page demandée n\'existe pas');
  46.         }
  47.         return $this->render('page/contact.html.twig', [
  48.             'page' => $page
  49.         ]);
  50.     }
  51.     /**
  52.      * @Route("/declarer-un-effet-indesirable", name="page.declarer-effet-indesirable", defaults={"seoEntity" = "Contenu\Page", "id" : Page::PAGE_DECLARER_EFFET_INDESIRABLE})
  53.      * @ParamConverter("page", class="App:Contenu\Page", options={"repository_method"="findById", "map_method_signature" = true})
  54.      * @return Response
  55.      */
  56.     public function declarerEffetIndesirableAction(Page $page): Response
  57.     {
  58.         if (false === $page->getVisible()) {
  59.             throw $this->createNotFoundException('La page demandée n\'existe pas');
  60.         }
  61.         return $this->render('page/declarer_effet_indesirable.html.twig', [
  62.             'page' => $page
  63.         ]);
  64.     }
  65.     /**
  66.      * @Route("/{slug}", name="page.detail", defaults={"seoEntity" = "Contenu\Page"}, requirements={"slug":".+"})
  67.      * @ParamConverter("page", class="App:Contenu\Page", options={"repository_method"="findByTranslatedSlug", "map_method_signature" = true})
  68.      * @return Response
  69.      */
  70.     public function detail(Page $page): Response
  71.     {
  72.         if (false === $page->getVisible()) {
  73.             throw $this->createNotFoundException('La page demandée n\'existe pas');
  74.         }
  75.         return $this->render('page/detail.html.twig', [
  76.             'page' => $page
  77.         ]);
  78.     }
  79. }