src/Controller/ContentController1.php line 13

  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ContentRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class ContentController1 extends AbstractController
  8. {
  9.     #[Route('/{_locale<%app.supported_locales%>}/content/{type}/list'name'app_content')]
  10.     public function index(int $typeContentRepository $repository): Response
  11.     {
  12.         $contents $repository->findBy(['type' => $type]);
  13.         return $this->render('frontend/content/index.html.twig', [
  14.             'type' => $type,
  15.             'contents' => $contents
  16.         ]);
  17.     }
  18.     #[Route('/{_locale<%app.supported_locales%>}/content/{type}/show/{id}'name'app_content_show_user')]
  19.     public function contentShow(int $typeint $idContentRepository $repository): Response
  20.     {
  21.         $contents $repository->findBy(['type' => $type]);
  22.         return $this->render('frontend/content/show.html.twig', [
  23.             'item' => $repository->find($id),
  24.         ]);
  25.     }
  26. }