src/EventSubscriber/EstablishmentSelectionSubscriber.php line 25
<?phpnamespace App\EventSubscriber;use Symfony\Bundle\SecurityBundle\Security;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpKernel\Event\RequestEvent;use Symfony\Component\Routing\Generator\UrlGeneratorInterface;use Symfony\Component\Security\Http\Event\LoginSuccessEvent;class EstablishmentSelectionSubscriber implements EventSubscriberInterface{public function __construct(private UrlGeneratorInterface $urlGenerator, private Security $security) {}public static function getSubscribedEvents(): array{return [RequestEvent::class => 'onKernelRequest',];}public function onKernelRequest(RequestEvent $event){$request = $event->getRequest();$session = $request->getSession();/*if (!$session->has('establishment_id') && !$this->isAutorisedRoute($request) && $this->security->getUser()) {$url = $this->urlGenerator->generate('app_establishment_select');$response = new RedirectResponse($url);$event->setResponse($response);}*/}private function isAutorisedRoute(Request $request): bool{$currentRouteName = $request->attributes->get('_route');return in_array($currentRouteName, ['site_landing', 'app_self', 'app_establishment_new', 'app_invitation_show']);}}