src/Controller/HomeController.php line 18

  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\CabinetRepository;
  4. use App\Repository\CategoryRepository;
  5. use App\Repository\DomaineRepository;
  6. use App\Repository\HomepageRepository;
  7. use App\Repository\PageRepository;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. class HomeController extends AbstractController
  13. {
  14.     #[Route('/'name'app_home')]
  15.     public function index(
  16.         Request $request,
  17.         HomepageRepository $homepageRepository,
  18.         DomaineRepository $domaineRepository,
  19.         CabinetRepository $cabinetRepository,
  20.         PageRepository $pageRepository,
  21.         CategoryRepository $categoryRepository
  22.     ): Response
  23.     {
  24.         $pathInfo $request->getPathInfo();
  25.         return $this->render('home/index.html.twig', [
  26.             'homepage' => $homepageRepository->findAll(),
  27.             'domaines' => $domaineRepository->findAll(),
  28.             'cabinets' => $cabinetRepository->findAll(),
  29.             'pathInfo' =>$pathInfo,
  30.             'page' => $pageRepository->findByPage($pathInfo),
  31.             'categories' => $categoryRepository->findAll(),
  32.             'pageTitle' => 'home',
  33.         ]);
  34.     }
  35. }