absenceMapper->findById($id); } catch (DoesNotExistException|\OCP\DB\Exception $e) { $this->logger->error('Failed to dispatch out-of-office event: ' . $e->getMessage(), [ 'exception' => $e, 'argument' => $argument, ]); return; } $userId = $absence->getUserId(); $user = $this->userManager->get($userId); if ($user === null) { $this->logger->error("Failed to dispatch out-of-office event: User $userId does not exist", [ 'argument' => $argument, ]); return; } $data = $absence->toOutOufOfficeData( $user, $this->timezoneService->getUserTimezone($userId) ?? $this->timezoneService->getDefaultTimezone(), ); if ($event === self::EVENT_START) { $this->eventDispatcher->dispatchTyped(new OutOfOfficeStartedEvent($data)); } elseif ($event === self::EVENT_END) { $this->eventDispatcher->dispatchTyped(new OutOfOfficeEndedEvent($data)); } else { $this->logger->error("Invalid out-of-office event: $event", [ 'argument' => $argument, ]); } } }