*/ class CalendarPublicationListener implements IEventListener { public function __construct( private Backend $activityBackend, private LoggerInterface $logger, ) { } /** * In case the user has set their default calendar to the deleted one */ public function handle(Event $event): void { if ($event instanceof CalendarPublishedEvent) { $this->logger->debug('Creating activity for Calendar being published'); $this->activityBackend->onCalendarPublication( $event->getCalendarData(), true ); } elseif ($event instanceof CalendarUnpublishedEvent) { $this->logger->debug('Creating activity for Calendar being unpublished'); $this->activityBackend->onCalendarPublication( $event->getCalendarData(), false ); } } }