src/Controller/SitesController.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Site;
  4. use App\Repository\SiteRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class SitesController extends AbstractController
  9. {
  10.     #[Route('/realisations'name'realisations')]
  11.     public function realisations(SiteRepository $siteRepository): Response
  12.     {
  13.         $sites $siteRepository->findBy(
  14.             array(),
  15.             array('createdAt' => 'DESC')
  16.         );
  17.         return $this->render('frontend/realisations.html.twig', [
  18.             'sites' => $sites,
  19.         ]);
  20.     }
  21.     #[Route('/{slug}'name'site_show')]
  22.     public function show(Site $site): Response
  23.     {
  24.         return $this->render('frontend/realisations_detail.html.twig', [
  25.             'site' => $site,
  26.         ]);
  27.     }
  28. }