<?php
namespace App\Controller;
use App\Repository\ExpertiseRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ExpertiseController extends AbstractController
{
/**
* @Route("/expertises", name="expertises")
*/
public function index(ExpertiseRepository $expertiseRepository): Response
{
return $this->render('page/expertises.html.twig', [
'expertises' => $expertiseRepository->findAll(),
]);
}
/**
* @Route("/expertises/{slug}", name="expertise_detail")
*/
public function detail(string $slug, ExpertiseRepository $expertiseRepository): Response
{
$expertise = $expertiseRepository->findOneBy(['slug' => $slug]);
return $this->render('page/expertise_detail.html.twig', [
'expertise' => $expertise,
'expertises' => $expertiseRepository->findAll(),
]);
}
}