Commit d02fd0be authored by Fabien Potencier's avatar Fabien Potencier

changed before and after filters to only run for the master request (as it's...

changed before and after filters to only run for the master request (as it's mainly used for set up and tear down)
parent b5c10054
......@@ -354,6 +354,10 @@ through before and after filters. All you need to do is pass a closure::
// tear down
});
.. note::
The filters are only run for the "master" Request.
Error handlers
--------------
......
......@@ -357,7 +357,9 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
} catch (RoutingException $e) {
// make sure onSilexBefore event is dispatched
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
$this['dispatcher']->dispatch(SilexEvents::BEFORE);
}
if ($e instanceof ResourceNotFoundException) {
$message = sprintf('No route found for "%s %s"', $this['request']->getMethod(), $this['request']->getPathInfo());
......@@ -370,8 +372,10 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
throw $e;
}
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
$this['dispatcher']->dispatch(SilexEvents::BEFORE);
}
}
/**
* Handles converters.
......@@ -408,8 +412,10 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function onKernelResponse(Event $event)
{
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
$this['dispatcher']->dispatch(SilexEvents::AFTER);
}
}
/**
* Executes registered error handlers until a response is returned,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment