src/Controller/AccueilController.php line 47

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\FormationRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. /**
  8.  * Controleur de l'accueil
  9.  *
  10.  * @author emds
  11.  */
  12. class AccueilController extends AbstractController
  13. {
  14.       
  15.     /**
  16.      * @var FormationRepository
  17.      */
  18.     private $repository;
  19.     
  20.     /**
  21.      *
  22.      * @param FormationRepository $repository
  23.      */
  24.     public function __construct(FormationRepository $repository)
  25.     {
  26.         $this->repository $repository;
  27.     }
  28.     
  29.     /**
  30.      * @Route("/", name="accueil")
  31.      * @return Response
  32.      */
  33.     public function index(): Response
  34.     {
  35.         $formations $this->repository->findAllLasted(2);
  36.         return $this->render("pages/accueil.html.twig", [
  37.             'formations' => $formations
  38.         ]);
  39.     }
  40.     
  41.     /**
  42.      * @Route("/cgu", name="cgu")
  43.      * @return Response
  44.      */
  45.     public function cgu(): Response
  46.     {
  47.         return $this->render("pages/cgu.html.twig");
  48.     }
  49. }