src/Action/ProjectAction.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types 1);
  3. namespace App\Action;
  4. use App\Infra\Services\ApiService;
  5. use App\Infra\Services\PopupService;
  6. use App\Responder\RedirectResponder;
  7. use App\Responder\TemplateResponder;
  8. use App\Infra\Services\FilterApiService;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Component\HttpFoundation\RequestStack;
  11. use Symfony\Contracts\HttpClient\HttpClientInterface;
  12. use App\Domain\Repository\Interfaces\TextRepositoryInterface;
  13. class ProjectAction extends AbstractAction
  14. {
  15.     public function __construct(
  16.         TemplateResponder $templateResponder,
  17.         RedirectResponder $redirectResponder,
  18.         FilterApiService $filterApiService,
  19.         RequestStack $requestStack
  20.     )
  21.     {
  22.         parent::__construct($templateResponder$redirectResponder$requestStack);
  23.         //$this->templateResponder = $templateResponder;
  24.         //$this->redirectResponder = $redirectResponder;
  25.         $this->filterApiService $filterApiService;
  26.     }
  27.     /**
  28.      * @Route("/projets", name="projects")
  29.      */
  30.     public function __invoke()
  31.     {
  32.         $projects $this->filterApiService->getAllProjects();
  33.         $projects array_reverse($projects);
  34.         $popup = new PopupService($this->request);
  35.         
  36.         $response $this->templateResponder->__invoke('project.html.twig', [
  37.             'projects' => $projects,
  38.             'popup2024' => $popup->showPopup()
  39.         ]);
  40.         if($popup->showPopup()) $response->headers->setCookie($popup->getCookie());
  41.         return $response;
  42.     }
  43. }