src/Controller/ContentController1.php line 23
<?php
namespace App\Controller;
use App\Repository\ContentRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ContentController1 extends AbstractController
{
#[Route('/{_locale<%app.supported_locales%>}/content/{type}/list', name: 'app_content')]
public function index(int $type, ContentRepository $repository): Response
{
$contents = $repository->findBy(['type' => $type]);
return $this->render('frontend/content/index.html.twig', [
'type' => $type,
'contents' => $contents
]);
}
#[Route('/{_locale<%app.supported_locales%>}/content/{type}/show/{id}', name: 'app_content_show_user')]
public function contentShow(int $type, int $id, ContentRepository $repository): Response
{
$contents = $repository->findBy(['type' => $type]);
return $this->render('frontend/content/show.html.twig', [
'item' => $repository->find($id),
]);
}
}