<?php
declare(strict_types = 1);
namespace App\Action;
use App\Domain\Repository\Interfaces\TextRepositoryInterface;
use App\Infra\Services\ApiService;
use App\Infra\Services\FilterApiService;
use App\Responder\RedirectResponder;
use App\Responder\TemplateResponder;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class ProjectAction extends AbstractAction
{
public function __construct(
TemplateResponder $templateResponder,
RedirectResponder $redirectResponder,
FilterApiService $filterApiService
)
{
$this->templateResponder = $templateResponder;
$this->redirectResponder = $redirectResponder;
$this->filterApiService = $filterApiService;
}
/**
* @Route("/projets", name="projects")
*/
public function __invoke()
{
$projects = $this->filterApiService->getAllProjects();
return $this->templateResponder->__invoke('project.html.twig', [
'projects' => $projects
]);
}
}