src/Listener/SupervisorAssignedSubscriber.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\Listener;
  3. use App\Event\SupervisorAssignedEvent;
  4. use App\Manager\NotificationManager;
  5. use Psr\Log\LoggerInterface;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class SupervisorAssignedSubscriber implements EventSubscriberInterface
  8. {
  9.     public const SUPERVISOR_ASSIGNED_DONE 'supervisor.assigned.done';
  10.     /**
  11.      * @var NotificationManager
  12.      */
  13.     protected $notificationManager;
  14.     /**
  15.      * @var LoggerInterface
  16.      */
  17.     protected $logger;
  18.     public function __construct(
  19.         NotificationManager $notificationManager,
  20.         LoggerInterface $logger
  21.     ) {
  22.         $this->notificationManager $notificationManager;
  23.         $this->logger $logger;
  24.     }
  25.     /**
  26.      * @return array
  27.      */
  28.     public static function getSubscribedEvents(): array
  29.     {
  30.         return [
  31.             static::SUPERVISOR_ASSIGNED_DONE => 'onSupervisorAssignedDone',
  32.         ];
  33.     }
  34.     /**
  35.      * Bootstraps status change hooks.
  36.      *
  37.      * @param SupervisorAssignedEvent $event
  38.      *
  39.      * @return void
  40.      */
  41.     public function onSupervisorAssignedDone(SupervisorAssignedEvent $event): void
  42.     {
  43.         $request $event->getSubject();
  44.         $notification $this->notificationManager->getSupervisorAssignedNotification($request);
  45.         $this->notificationManager->notify($notification);
  46.     }
  47. }