src/Controller/Website/ArticlesController.php line 47

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Website;
  3. use App\Repository\ArticlesRepository;
  4. use Sulu\Component\Rest\RequestParametersTrait;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Twig\Environment;
  9. class ArticlesController extends AbstractController
  10. {
  11.     use RequestParametersTrait;
  12.     private $twig;
  13.     private $ap;
  14.     public function __construct(Environment $twigArticlesRepository $ap)
  15.     {
  16.         $this->twig $twig;
  17.         $this->ap $ap;
  18.     }
  19.     /**
  20.      * Trouve les articles selon un tag donnĂ©
  21.      * 
  22.      * @return Response
  23.      */
  24.     public function getArticlesByTagAction(Request $req): Response
  25.     {
  26.         $request $this->ap->getArticlesByTag($req);
  27.         $res = new Response($this->twig->render('articles/articlesByTag.html.twig', ['request' => $request]));
  28.         return $res;
  29.     }
  30.     public function getAllAlauneArticles(Request $req): Response
  31.     {
  32.         $thematiques $this->getRequestParameter($req'thematiques'false'');
  33.         $request $this->ap->getAlauneArticles($thematiques);
  34.         $res = new Response($this->twig->render('homepage-articles/alaune.html.twig', ['request' => $request]));
  35.         return $res;
  36.     }
  37.     public function getIncomingEvents(): Response
  38.     {
  39.         $request $this->ap->getIncomingEvents();
  40.         $res = new Response($this->twig->render('homepage-articles/evenementsavenir.html.twig', ['hits' => $request]));
  41.         return $res;
  42.     }
  43. }