Skip to content
Permalink
Browse files

Displays friendly message if the event does not have any registered l…

…isteners
  • Loading branch information...
Matthieu Auger authored and fabpot committed Oct 12, 2014
1 parent 8f1b757 commit a5628bdbe2fdb8267242678991f30b37edfd4b69
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
@@ -58,14 +58,28 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$dispatcher = $this->getEventDispatcher();
if ($event = $input->getArgument('event')) {
if (!$dispatcher->hasListeners($event)) {
$formatter = $this->getHelperSet()->get('formatter');
$formattedBlock = $formatter->formatBlock(
sprintf('[NOTE] The event "%s" does not have any registered listeners.', $event),
'fg=yellow',
true
);
$output->writeln($formattedBlock);
return;
}
$options = array('event' => $event);
} else {
$options = array();
}
$dispatcher = $this->getEventDispatcher();
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['raw_text'] = $input->getOption('raw');

0 comments on commit a5628bd

Please sign in to comment.
You can’t perform that action at this time.