src/Action/AboutAction.php line 13

Open in your IDE?
  1. <?php
  2. declare(strict_types 1);
  3. namespace App\Action;
  4. use App\Domain\Repository\Interfaces\TextRepositoryInterface;
  5. use App\Responder\RedirectResponder;
  6. use App\Responder\TemplateResponder;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use App\Domain\Repository\Interfaces\TeamRepositoryInterface;
  9. class AboutAction extends AbstractAction
  10. {
  11.     public function __construct(
  12.         TemplateResponder $templateResponder,
  13.         RedirectResponder $redirectResponder,
  14.         TeamRepositoryInterface $teamRepository
  15.     )
  16.     {
  17.         $this->templateResponder $templateResponder;
  18.         $this->redirectResponder $redirectResponder;
  19.         $this->teamRepository $teamRepository;
  20.     }
  21.     /**
  22.      * @Route("/a-propos", name="about")
  23.      */
  24.     public function __invoke()
  25.     {
  26.         $teams $this->teamRepository->findTeams();
  27.         $teamCategories = [];
  28.         foreach ($teams as $team) {
  29.             if (!isset($teamCategories[$team['categoryName']])) {
  30.                 $teamCategories[$team['categoryName']] = [
  31.                     $team
  32.                 ];
  33.             } else {
  34.                 $teamCategories[$team['categoryName']][] = $team;
  35.             }
  36.         }
  37.         
  38.         return $this->templateResponder->__invoke('about.html.twig', [
  39.             'teamCategories' => $teamCategories
  40.         ]);
  41.     }
  42. }