<?php
namespace App\Controller;
use App\Entity\Office;
use App\Repository\AvisRepository;
use App\Repository\LabelRepository;
use App\Repository\OfficeRepository;
use App\Repository\SettingRepository;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class OfficeController extends AbstractController
{
/**
* @Route("/nosoffices", name="app_office")
*/
public function index(
SettingRepository $settingRepository,
LabelRepository $labelRepository,
OfficeRepository $officeRepository
): Response
{
return $this->render('office/index.html.twig', [
'settings' => $settingRepository->findAll(),
'labels' => $labelRepository->findAll(),
'offices' => $officeRepository->findBy([], ['titre' => 'ASC']),
'pageTitle' => 'offices'
]);
}
/**
* @Route("/nosoffices/{slug}", name="app_office_show")
*/
public function show(
Office $office,
LabelRepository $labelRepository,
SettingRepository $settingRepository,
AvisRepository $avisRepository
): Response
{
return $this->render('office/show.html.twig', [
'office' => $office,
'labels' => $labelRepository->findAll(),
'settings' => $settingRepository->findAll(),
'avis' => $avisRepository->findByOfficeShow($office),
]);
}
}