Skip to content

Commit

Permalink
Register event subscriber in the boot method
Browse files Browse the repository at this point in the history
The Pimple::extend method was registering the listener each time it id called.
  • Loading branch information
GromNaN committed Oct 4, 2012
1 parent bdadc08 commit 8e8029c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions AcceptHeaderServiceProvider.php
Expand Up @@ -11,19 +11,16 @@ public function register(Application $app)
{ {
$app['route_class'] = '\\Pff\\ServiceProvider\\AcceptHeaderServiceProvider\\Route'; $app['route_class'] = '\\Pff\\ServiceProvider\\AcceptHeaderServiceProvider\\Route';


$app['dispatcher'] = $app->extend('dispatcher', function($dispatcher) {
$dispatcher->addSubscriber(new KernelListener());
return $dispatcher;
});

$app['url_matcher'] = $app->share(function () use ($app) { $app['url_matcher'] = $app->share(function () use ($app) {
$matcher = new UrlMatcher($app['routes'], $app['request_context']); $matcher = new UrlMatcher($app['routes'], $app['request_context']);
$matcher->setRequest($app['request']); $matcher->setRequest($app['request']);

return $matcher; return $matcher;
}); });
} }


public function boot(Application $app) public function boot(Application $app)
{ {
$app['dispatcher']->addSubscriber(new KernelListener());
} }
} }

0 comments on commit 8e8029c

Please sign in to comment.