src/EventSubscriber/Zoom/MeetingSubscriber.php line 40

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber\Zoom;
  3. use App\Event\Zoom\DeleteMeetingEvent;
  4. use App\Event\Zoom\NewMeetingEvent;
  5. use App\Event\Zoom\NewMeetingGroupEvent;
  6. use App\Event\Zoom\UpdateMeetingEvent;
  7. use App\Message\Zoom\DeleteMeeting;
  8. use App\Message\Zoom\NewMeeting;
  9. use App\Message\Zoom\NewMeetingGroup;
  10. use App\Message\Zoom\UpdateMeeting;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\Messenger\MessageBusInterface;
  13. class MeetingSubscriber implements EventSubscriberInterface
  14. {
  15.     private MessageBusInterface $bus;
  16.     public function __construct(MessageBusInterface $bus)
  17.     {
  18.         $this->bus $bus;
  19.     }
  20.     public static function getSubscribedEvents()
  21.     {
  22.         return [
  23.             NewMeetingEvent::NAME => 'createMeeting',
  24.             UpdateMeetingEvent::NAME => 'updateMeeting',
  25.             DeleteMeetingEvent::NAME => 'deleteMeeting',
  26.             NewMeetingGroupEvent::NAME => 'createGroupMeeting',
  27.         ];
  28.     }
  29.     public function createMeeting(NewMeetingEvent $even): void
  30.     {
  31.         $this->bus->dispatch(new NewMeeting($even->getMeeting()));
  32.     }
  33.     public function updateMeeting(UpdateMeetingEvent $event): void
  34.     {
  35.         $this->bus->dispatch(new UpdateMeeting($event->getMeeting()));
  36.     }
  37.     public function deleteMeeting(DeleteMeetingEvent $event): void
  38.     {
  39.         $this->bus->dispatch(new DeleteMeeting($event->getMeeting()));
  40.     }
  41.     public function createGroupMeeting(NewMeetingGroupEvent $even): void
  42.     {
  43.         $this->bus->dispatch(new NewMeetingGroup($even->getMeeting()));
  44.     }
  45. }