src/EventSubscriber/RevisionSubscriber.php line 36
<?phpnamespace App\EventSubscriber;use App\Event\Revision\RevisionAcceptedEvent;use App\Event\Revision\RevisionRefusedEvent;use App\Service\NotificationService;use Symfony\Component\EventDispatcher\EventSubscriberInterface;class RevisionSubscriber implements EventSubscriberInterface{public function __construct(private NotificationService $notificationService) {}public static function getSubscribedEvents(): array{return [RevisionAcceptedEvent::class => 'onRevisionAccepted',RevisionRefusedEvent::class => 'onRevisionRefused',];}public function onRevisionAccepted(RevisionAcceptedEvent $revisionAcceptedEvent): void{$revision = $revisionAcceptedEvent->getRevision();$this->notificationService->notifyUser($revision->getAuthor(),'Revision acceptée',sprintf("Votre pour <strong>%s</strong> a été acceptée",$revision->getContent()),$revision);}public function onRevisionRefused(RevisionRefusedEvent $revisionAcceptedEvent): void{$revision = $revisionAcceptedEvent->getRevision();$this->notificationService->notifyUser($revision->getAuthor(),'Revision refusée',sprintf("Votre pour <strong>%s</strong> a été refusée :(",$revision->getContent()),$revision);}}