src/Controller/ExpertiseController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ExpertiseRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class ExpertiseController extends AbstractController
  8. {
  9. /**
  10. * @Route("/expertises", name="expertises")
  11. */
  12. public function index(ExpertiseRepository $expertiseRepository): Response
  13. {
  14. return $this->render('page/expertises.html.twig', [
  15. 'expertises' => $expertiseRepository->findAll(),
  16. ]);
  17. }
  18. /**
  19. * @Route("/expertises/{slug}", name="expertise_detail")
  20. */
  21. public function detail(string $slug, ExpertiseRepository $expertiseRepository): Response
  22. {
  23. $expertise = $expertiseRepository->findOneBy(['slug' => $slug]);
  24. return $this->render('page/expertise_detail.html.twig', [
  25. 'expertise' => $expertise,
  26. 'expertises' => $expertiseRepository->findAll(),
  27. ]);
  28. }
  29. }