src/EventListener/Questionary/QuestionaryRoleDistributionEventListener.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\EventListener\Questionary;
  4. use App\Event\Questionary\QuestionaryRoleDistributionEvent;
  5. use App\Message\RoleDistributionQuestionaryDispatchMessage;
  6. use Symfony\Component\Messenger\MessageBusInterface;
  7. class QuestionaryRoleDistributionEventListener
  8. {
  9.     private MessageBusInterface $bus;
  10.     public function __construct(MessageBusInterface $bus)
  11.     {
  12.         $this->bus $bus;
  13.     }
  14.     public function onRoleDistribution(QuestionaryRoleDistributionEvent $event): void
  15.     {
  16.         $msg = new RoleDistributionQuestionaryDispatchMessage($event->getQuestionary()->getId());
  17.         $this->bus->dispatch($msg);
  18.     }
  19. }