setName('notification:delete')
->setDescription('Delete a generated admin notification for the given user')
->addArgument(
'user-id',
InputArgument::REQUIRED,
'User ID of the user to notify'
)
->addArgument(
'notification-id',
InputArgument::REQUIRED,
'The notification ID returned by the "notification:generate" command'
)
;
}
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = (string)$input->getArgument('user-id');
$notificationId = (int)$input->getArgument('notification-id');
try {
$notification = $this->notificationHandler->getById($notificationId, $userId);
} catch (NotificationNotFoundException) {
$output->writeln('Notification not found for user');
return 1;
}
$this->notificationManager->markProcessed($notification);
$output->writeln('Notification deleted successfully');
return 0;
}
}