Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions events.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/Command/ListStations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down