setName('dav:absence:get');
$this->addArgument(
'user-id',
InputArgument::REQUIRED,
'User ID of the affected account'
);
}
public function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('user-id');
$user = $this->userManager->get($userId);
if ($user === null) {
$output->writeln('User not found');
return 1;
}
$absence = $this->absenceService->getAbsence($userId);
if ($absence === null) {
$output->writeln('No absence set');
return 0;
}
$output->writeln('Start day: ' . $absence->getFirstDay());
$output->writeln('End day: ' . $absence->getLastDay());
$output->writeln('Short message: ' . $absence->getStatus());
$output->writeln('Message: ' . $absence->getMessage());
$output->writeln('Replacement user: ' . ($absence->getReplacementUserId() ?? 'none'));
$output->writeln('Replacement display name: ' . ($absence->getReplacementUserDisplayName() ?? 'none'));
return 0;
}
}