KnpLabs / ConsoleServiceProvider

A Console service provider for Silex
MIT License
107 stars 37 forks source link

Allow symfony/console to send events to the surrounding Silex. #9

Closed paul-m closed 7 years ago

paul-m commented 10 years ago

We can close the circle here and allow the console application to dispatch events.

paul-m commented 10 years ago

The workaround looks like this:

$app['dispatcher']->addListener(ConsoleEvents::INIT, function (ConsoleEvent $event) use ($app) {
  $console = $event->getApplication();
  $console->setDispatcher($app['dispatcher']);
});

It's a bit of a pain to keep the distinction between Knp's ConsoleEvents and Symfony's ConsoleEvents, but it works.

ghost commented 8 years ago

This looks like a good idea, thumbs up from me

skalpa commented 7 years ago

The recently merged #31 does just that, so I'm closing your PR.

Thank you @paul-m