src/Controller/HomeController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\EvenementRepository;
  4. use App\Repository\RealisationRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class HomeController extends AbstractController
  9. {
  10.     private $realisationRepository;
  11.     private $evenementRepository;
  12.     public function __construct(RealisationRepository $realisationRepositoryEvenementRepository $evenementRepository)
  13.     {
  14.         $this->realisationRepository $realisationRepository;
  15.         $this->evenementRepository $evenementRepository;
  16.     }
  17.     /**
  18.      * @Route("/", name="home")
  19.      */
  20.     public function index(): Response
  21.     {
  22.         $lastsReal $this->realisationRepository->findLasts(4);
  23.         $lastEvent $this->evenementRepository->findLasts(5);
  24.         return $this->render('home/index.html.twig', [
  25.             'lastsReal' => $lastsReal,
  26.             'lastsEvent' => $lastEvent,
  27.         ]);
  28.     }
  29. }