src/EventSubscriber/PendingNotificationLoginSubscriber.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Manager\PendingNotificationManager;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
  6. class PendingNotificationLoginSubscriber implements EventSubscriberInterface
  7. {
  8.     public function __construct(
  9.         private readonly PendingNotificationManager $pendingNotificationManager,
  10.     ) {
  11.     }
  12.     public static function getSubscribedEvents(): array
  13.     {
  14.         return [
  15.             InteractiveLoginEvent::class => 'onLogin',
  16.         ];
  17.     }
  18.     public function onLogin(InteractiveLoginEvent $event): void
  19.     {
  20.         // Le front récupère la file via /api/notifications/pending pour afficher les toasts.
  21.         // Laisser la file intacte ici évite de la vider avant que le JS ne l'affiche.
  22.     }
  23. }