<?php
declare(strict_types=1);
namespace App\EventListener\Questionary;
use App\Event\Questionary\QuestionaryRoleDistributionEvent;
use App\Message\RoleDistributionQuestionaryDispatchMessage;
use Symfony\Component\Messenger\MessageBusInterface;
class QuestionaryRoleDistributionEventListener
{
private MessageBusInterface $bus;
public function __construct(MessageBusInterface $bus)
{
$this->bus = $bus;
}
public function onRoleDistribution(QuestionaryRoleDistributionEvent $event): void
{
$msg = new RoleDistributionQuestionaryDispatchMessage($event->getQuestionary()->getId());
$this->bus->dispatch($msg);
}
}