<?php
namespace App\Controller;
use App\Repository\AvisRepository;
use App\Repository\HomepageRepository;
use App\Repository\LabelRepository;
use App\Repository\OfficeRepository;
use App\Repository\SettingRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
/**
* @Route("/", name="app_home")
*/
public function index(
SettingRepository $settingRepository,
HomepageRepository $homepageRepository,
LabelRepository $labelRepository,
AvisRepository $avisRepository,
OfficeRepository $officeRepository
): Response
{
$officeMelun = $officeRepository->findBy(['id' => 2], []);
$officeParis = $officeRepository->findBy(['id' => 1], []);
$officeSenart = $officeRepository->findBy(['id' => 3], []);
return $this->render('home/index.html.twig', [
'settings' => $settingRepository->findAll(),
'homes' => $homepageRepository->findAll(),
'labels' => $labelRepository->findAll(),
'avisMelun' => $avisRepository->finBydOffice($officeMelun),
'avisParis' => $avisRepository->finBydOffice($officeParis),
'avisSenart' => $avisRepository->finBydOffice($officeSenart),
'avis' => $avisRepository->findBy(['isEnabled' => true], []),
'pageTitle' => 'home'
]);
}
/**
* @Route("/mentions-legales", name="app_mentions_legales")
*/
public function mentions(
SettingRepository $settingRepository,
LabelRepository $labelRepository
)
{
return $this->render('home/mentions.html.twig', [
'settings' => $settingRepository->findAll(),
'labels' => $labelRepository->findAll(),
'pageTitle' => 'mentions'
]);
}
}