src/Controller/ActualiteController.php line 12
<?php
namespace App\Controller;
use App\Service\ActualityCCAMService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route('/actualites', name: 'actuality_')]
class ActualiteController extends AbstractController
{
#[Route('', name: 'index')]
public function index(ActualityCCAMService $actualityCCAMService): Response
{
$response = $actualityCCAMService->getAll();
$actualities = json_decode($response);
return $this->render('pages/actualite.html.twig', [
'actualities' => $actualities
]);
}
#[Route('/{slug}-{id}', name: 'show', requirements: ['id' => '\d+', 'slug' => '[a-z0-9\-]*'])]
public function show(string $slug, int $id, ActualityCCAMService $actualityCCAMService): Response
{
$response = $actualityCCAMService->getById($id);
$actuality = json_decode($response);
return $this->render('pages/actualite/show.html.twig', [
'actuality' => $actuality
]);
}
}