diff --git a/events.php b/events.php index b137e03..42ba7f6 100644 --- a/events.php +++ b/events.php @@ -3,17 +3,15 @@ declare(strict_types=1); use App\Event; +use Azura\SlimCallableEventDispatcher\CallableEventDispatcherInterface; -return function (\App\EventDispatcher $dispatcher) +return function (CallableEventDispatcherInterface $dispatcher) { // Add the "example:list-stations" command to the CLI prompt. $dispatcher->addListener(Event\BuildConsoleCommands::class, function (Event\BuildConsoleCommands $event) { - $console = $event->getConsole(); - - $console->command( - 'example:list-stations', - \Plugin\ExamplePlugin\Command\ListStations::class, - )->setDescription('An example function to list stations in a table view.'); + $event->addAliases([ + 'example:list-stations' => \Plugin\ExamplePlugin\Command\ListStations::class, + ]); }, -1); // Tell the view handler to look for templates in this directory too diff --git a/src/Command/ListStations.php b/src/Command/ListStations.php index b9bc783..aebd824 100644 --- a/src/Command/ListStations.php +++ b/src/Command/ListStations.php @@ -7,8 +7,13 @@ use App\Console\Command\CommandAbstract; use App\Radio\Adapters; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand( + name: 'example:list-stations', + description: 'An example function to list stations in a table view.', +)] class ListStations extends CommandAbstract { public function __invoke(