mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add ProcessWatchlists command
This commit is contained in:
42
src/Command/ProcessWatchlistsCommand.php
Normal file
42
src/Command/ProcessWatchlistsCommand.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\Message\ProcessWatchListsTrigger;
|
||||||
|
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(
|
||||||
|
name: 'app:process-watchlists',
|
||||||
|
description: 'Process watchlists and send emails if necessary',
|
||||||
|
)]
|
||||||
|
class ProcessWatchlistsCommand extends Command
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
$this->bus->dispatch(new ProcessWatchListsTrigger());
|
||||||
|
|
||||||
|
$io->success('Watchlist processing triggered!');
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user