*/ class CircleDeletedListener implements IEventListener { public function __construct( private Manager $manager, private ParticipantService $participantService, ) { } #[\Override] public function handle(Event $event): void { if (!($event instanceof CircleDestroyedEvent)) { // Unrelated return; } $circleId = $event->getCircle()->getSingleId(); // Remove the circle itself from being a participant $rooms = $this->manager->getRoomsForActor(Attendee::ACTOR_CIRCLES, $circleId); foreach ($rooms as $room) { $participant = $this->participantService->getParticipantByActor($room, Attendee::ACTOR_CIRCLES, $circleId); $this->participantService->removeAttendee($room, $participant, AAttendeeRemovedEvent::REASON_REMOVED); } } }