2024-08-03 16:08:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Command;
|
|
|
|
|
|
2025-10-25 17:26:56 +02:00
|
|
|
use App\Message\ProcessWatchlistTrigger;
|
2024-08-03 16:08:59 +02:00
|
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
|
use Symfony\Component\Messenger\Exception\ExceptionInterface;
|
|
|
|
|
use Symfony\Component\Messenger\MessageBusInterface;
|
|
|
|
|
|
|
|
|
|
#[AsCommand(
|
2025-10-25 17:26:56 +02:00
|
|
|
name: 'app:process-watchlist',
|
|
|
|
|
description: 'Process watchlist and send emails if necessary',
|
2024-08-03 16:08:59 +02:00
|
|
|
)]
|
2025-10-25 17:26:56 +02:00
|
|
|
class ProcessWatchlistCommand extends Command
|
2024-08-03 16:08:59 +02:00
|
|
|
{
|
|
|
|
|
public function __construct(private readonly MessageBusInterface $bus)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configure(): void
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws ExceptionInterface
|
|
|
|
|
*/
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
|
|
|
{
|
|
|
|
|
$io = new SymfonyStyle($input, $output);
|
|
|
|
|
|
2025-10-25 17:26:56 +02:00
|
|
|
$this->bus->dispatch(new ProcessWatchlistTrigger());
|
2024-08-03 16:08:59 +02:00
|
|
|
|
|
|
|
|
$io->success('Watchlist processing triggered!');
|
|
|
|
|
|
|
|
|
|
return Command::SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
}
|