src/Controller/Front/ConventionController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Knp\Component\Pager\PaginatorInterface;
  7. use App\Repository\Law\ConventionRepository;
  8. use App\Entity\Law\Convention;
  9. class ConventionController extends AbstractController
  10. {
  11.     public function index(Request $requestConventionRepository $repositoryPaginatorInterface $paginator): Response
  12.     {
  13.         $keyword $request->query->get('keyword');
  14.         $query $repository->findConventionsQuery($keyword);
  15.         $conventions $paginator->paginate($query$request->query->getInt('page'1), 3);
  16.         $recentConventions $repository->findRecent();
  17.         return $this->render('front/convention/index.html.twig', [
  18.             'conventions' => $conventions,
  19.             'keyword' => $keyword,
  20.             'recentConventions' => $recentConventions,
  21.         ]);
  22.     }
  23.     public function show(Convention $conventionConventionRepository $repository): Response
  24.     {
  25.         $recentConventions $repository->findRecent();
  26.         return $this->render('front/convention/show.html.twig', [
  27.             'convention' => $convention,
  28.             'recentConventions' => $recentConventions,
  29.         ]);
  30.     }
  31. }