<?php
declare(strict_types = 1);
namespace App\Action;
use App\Domain\Repository\Interfaces\TextRepositoryInterface;
use App\Responder\RedirectResponder;
use App\Responder\TemplateResponder;
use Symfony\Component\Routing\Annotation\Route;
use App\Domain\Repository\Interfaces\TeamRepositoryInterface;
class AboutAction extends AbstractAction
{
public function __construct(
TemplateResponder $templateResponder,
RedirectResponder $redirectResponder,
TeamRepositoryInterface $teamRepository
)
{
$this->templateResponder = $templateResponder;
$this->redirectResponder = $redirectResponder;
$this->teamRepository = $teamRepository;
}
/**
* @Route("/a-propos", name="about")
*/
public function __invoke()
{
$teams = $this->teamRepository->findTeams();
$teamCategories = [];
foreach ($teams as $team) {
if (!isset($teamCategories[$team['categoryName']])) {
$teamCategories[$team['categoryName']] = [
$team
];
} else {
$teamCategories[$team['categoryName']][] = $team;
}
}
return $this->templateResponder->__invoke('about.html.twig', [
'teamCategories' => $teamCategories
]);
}
}