src/Controller/HomeController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\AvisRepository;
  4. use App\Repository\HomepageRepository;
  5. use App\Repository\LabelRepository;
  6. use App\Repository\OfficeRepository;
  7. use App\Repository\SettingRepository;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class HomeController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/", name="app_home")
  15.      */
  16.     public function index(
  17.         SettingRepository $settingRepository,
  18.         HomepageRepository $homepageRepository,
  19.         LabelRepository $labelRepository,
  20.         AvisRepository $avisRepository,
  21.         OfficeRepository $officeRepository
  22.     ): Response
  23.     {
  24.         $officeMelun $officeRepository->findBy(['id' => 2], []);
  25.         $officeParis $officeRepository->findBy(['id' => 1], []);
  26.         $officeSenart $officeRepository->findBy(['id' => 3], []);
  27.         return $this->render('home/index.html.twig', [
  28.             'settings' => $settingRepository->findAll(),
  29.             'homes' => $homepageRepository->findAll(),
  30.             'labels' => $labelRepository->findAll(),
  31.             'avisMelun' => $avisRepository->finBydOffice($officeMelun),
  32.             'avisParis' => $avisRepository->finBydOffice($officeParis),
  33.             'avisSenart' => $avisRepository->finBydOffice($officeSenart),
  34.             'avis' => $avisRepository->findBy(['isEnabled' => true], []),
  35.             'pageTitle' => 'home'
  36.         ]);
  37.     }
  38.     /**
  39.      * @Route("/mentions-legales", name="app_mentions_legales")
  40.      */
  41.     public function mentions(
  42.         SettingRepository $settingRepository,
  43.         LabelRepository $labelRepository
  44.     )
  45.     {
  46.         return $this->render('home/mentions.html.twig', [
  47.             'settings' => $settingRepository->findAll(),
  48.             'labels' => $labelRepository->findAll(),
  49.             'pageTitle' => 'mentions'
  50.         ]);
  51.     }
  52. }