diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 3fee78f30b7..a260aa5a9ad 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -167,6 +167,11 @@ return a ``Response`` directly, or to add information to the ``Request`` (e.g. setting the locale or setting some other information on the ``Request`` attributes). +.. note:: + + When setting a response for the ``kernel.request`` event, the propagation + is stopped. This means listeners with lower priority won't be executed. + .. sidebar:: ``kernel.request`` in the Symfony Framework The most important listener to ``kernel.request`` in the Symfony Framework @@ -391,6 +396,11 @@ At this stage, if no listener sets a response on the event, then an exception is thrown: either the controller *or* one of the view listeners must always return a ``Response``. +.. note:: + + When setting a response for the ``kernel.view`` event, the propagation + is stopped. This means listeners with lower priority won't be executed. + .. sidebar:: ``kernel.view`` in the Symfony Framework There is no default listener inside the Symfony Framework for the ``kernel.view`` @@ -522,6 +532,11 @@ comes with an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionLi which if you choose to use, will do this and more by default (see the sidebar below for more details). +.. note:: + + When setting a response for the ``kernel.exception`` event, the propagation + is stopped. This means listeners with lower priority won't be executed. + .. sidebar:: ``kernel.exception`` in the Symfony Framework There are two main listeners to ``kernel.exception`` when using the diff --git a/cookbook/service_container/event_listener.rst b/cookbook/service_container/event_listener.rst index a78acded921..ecba442b697 100644 --- a/cookbook/service_container/event_listener.rst +++ b/cookbook/service_container/event_listener.rst @@ -57,6 +57,12 @@ event is just one of the core kernel events:: the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`. To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`. +.. note:: + + When setting a response for the ``kernel.request``, ``kernel.view`` and + ``kernel.exception`` events, the propagation is stopped, so the lower + priority listeners on that event don't get called. + Now that the class is created, you just need to register it as a service and notify Symfony that it is a "listener" on the ``kernel.exception`` event by using a special "tag":