src/Controller/HomeController.php line 17

  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ArticleRepository;
  4. use App\Repository\ImageOutingsRepository;
  5. use App\Repository\NewsRepository;
  6. use App\Repository\OutingRepository;
  7. use App\Repository\PorteursRepository;
  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.     #[Route('/'name'app_home')]
  14.     public function index(OutingRepository $outingRepositoryNewsRepository $newsRepositoryImageOutingsRepository $ImageOutingsRepositoryPorteursRepository $PorteursRepository): Response
  15.     {
  16.         return $this->render('home/index.html.twig', [
  17.             'outings' => $outingRepository->findFutureOutings(),
  18.             'news' => $newsRepository->findFutureNews(),
  19.             'imageOutings' => $ImageOutingsRepository->findAll(),
  20.             'porteurs' => $PorteursRepository->getAllByBirthdate()
  21.         ]);
  22.     }
  23.     #[Route('/legendes/{giant}'name'app_legends')]
  24.     public function legendIsidore($giant): Response
  25.     {
  26.         $giant strtolower($giant);
  27.         if ($giant === 'isidore'){
  28.             return $this->render('legends/isidore.html.twig', [
  29.             ]);
  30.         }
  31.         if ($giant === 'ernest'){
  32.             return $this->render('legends/ernest.html.twig', [
  33.             ]);
  34.         }
  35.     }
  36. //    #[Route('/a_propos', name: 'app_about')]
  37. //    public function about(ArticleRepository $articleRepository): Response
  38. //    {
  39. //        return $this->render('home/about.html.twig', [
  40. //        ]);
  41. //    }
  42.     #[Route('/press'name'app_press')]
  43.     public function press(ArticleRepository $articleRepository): Response
  44.     {
  45.         return $this->render('home/press.html.twig', [
  46.             'articles' => $articleRepository->findBy([], ['createdAt' => 'DESC']),
  47.         ]);
  48.     }
  49. }