<?php
namespace App\EventSubscriber\Zoom;
use App\Event\Zoom\DeleteMeetingEvent;
use App\Event\Zoom\NewMeetingEvent;
use App\Event\Zoom\NewMeetingGroupEvent;
use App\Event\Zoom\UpdateMeetingEvent;
use App\Message\Zoom\DeleteMeeting;
use App\Message\Zoom\NewMeeting;
use App\Message\Zoom\NewMeetingGroup;
use App\Message\Zoom\UpdateMeeting;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Messenger\MessageBusInterface;
class MeetingSubscriber implements EventSubscriberInterface
{
private MessageBusInterface $bus;
public function __construct(MessageBusInterface $bus)
{
$this->bus = $bus;
}
public static function getSubscribedEvents()
{
return [
NewMeetingEvent::NAME => 'createMeeting',
UpdateMeetingEvent::NAME => 'updateMeeting',
DeleteMeetingEvent::NAME => 'deleteMeeting',
NewMeetingGroupEvent::NAME => 'createGroupMeeting',
];
}
public function createMeeting(NewMeetingEvent $even): void
{
$this->bus->dispatch(new NewMeeting($even->getMeeting()));
}
public function updateMeeting(UpdateMeetingEvent $event): void
{
$this->bus->dispatch(new UpdateMeeting($event->getMeeting()));
}
public function deleteMeeting(DeleteMeetingEvent $event): void
{
$this->bus->dispatch(new DeleteMeeting($event->getMeeting()));
}
public function createGroupMeeting(NewMeetingGroupEvent $even): void
{
$this->bus->dispatch(new NewMeetingGroup($even->getMeeting()));
}
}