*/ class ThreadListener implements IEventListener { public function __construct( protected readonly ThreadService $threadService, ) { } #[\Override] public function handle(Event $event): void { if ($event instanceof AttendeesRemovedEvent) { $attendeeIds = array_map(static fn (Attendee $attendee): int => $attendee->getId(), $event->getAttendees()); $this->threadService->removeThreadAttendeesByAttendeeIds($attendeeIds); } } }