src/Controller/FooterController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use App\Service\ConfigurationPropertyService;
  5. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  6. use App\Entity\EntityFinder;
  7. use App\Security\ClubAccess;
  8. use App\Entity\Club;
  9. use Psr\Log\LoggerInterface;
  10. class FooterController extends AbstractController
  11. {
  12.     
  13.     private LoggerInterface $logger;
  14.     
  15.     public function __construct(LoggerInterface $logger)
  16.     {
  17.         $this->logger $logger;
  18.     }
  19.     
  20.     public function viewFooter(SessionInterface $session)
  21.     {
  22.         $doctrine $this->container->get('doctrine');
  23.         $propService = new ConfigurationPropertyService($doctrine->getManager());
  24.         $cenacleProperties $propService->findStartsWithToMap('cenacle.');
  25.         $clubProperties $propService->findStartsWithToMap('club.');
  26.         $club $session->get('club-selected');
  27.         
  28.         $canConfigure false;
  29.         if($club !== null) {
  30.             $entityFinder = new EntityFinder($doctrine);
  31.             $clubObj $entityFinder->findOneByOrThrow(Club::class, ['uuid' => $club->uuid]); // 404, never happen !
  32.             
  33.             $clubAccess = new ClubAccess($this->container$this->logger);
  34.             $canConfigure $clubAccess->hasAccessForUser($clubObj$this->getUser());
  35.         }
  36.         
  37.         return $this->render('modules/footer.html.twig', [
  38.             'cenacleProperties' => $cenacleProperties,
  39.             'clubProperties' => $clubProperties,
  40.             'club' => $club,
  41.             'canConfigure' => $canConfigure
  42.         ]);
  43.     }
  44. }