src/Controller/Front/HomeController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use App\Entity\Project;
  4. use App\Repository\ContentRepository;
  5. use App\Repository\ProjectRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class HomeController extends AbstractController
  9. {
  10.     /**
  11.      * @Route("/{_locale}", defaults={"_locale"="fr"}, name="front_home")
  12.      */
  13.     public function home(string $_localeContentRepository $contentRepositoryProjectRepository $projectRepository)
  14.     {
  15.         return $this->render('front/home.html.twig', [
  16.             'contentHeader' => $contentRepository->findOneBy(['page' => 'home''section' => 'header''lang' => $_locale]),
  17.             'contentBlock1' => $contentRepository->findOneBy(['page' => 'home''section' => 'block1''lang' => $_locale]),
  18.             'contentBlock2' => $contentRepository->findOneBy(['page' => 'home''section' => 'block2''lang' => $_locale]),
  19.             'contentBlock3' => $contentRepository->findOneBy(['page' => 'home''section' => 'block3''lang' => $_locale]),
  20.             'contentBlock4' => $contentRepository->findOneBy(['page' => 'home''section' => 'block4''lang' => $_locale]),
  21.             'contentBlock5' => $contentRepository->findOneBy(['page' => 'home''section' => 'block5''lang' => $_locale]),
  22.             'latestProjects' => $projectRepository->findBy(['isPublished' => Project::PROJECT_PUBLISHED], ['id' => 'DESC'], 5)
  23.         ]);
  24.     }
  25. }