Skip to content

Commit 25e1069

Browse files
committed
Added notes specifying the propagation behaviour for kernel.view and kernel.exception.
1 parent bf61658 commit 25e1069

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

components/http_kernel/introduction.rst

+10
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ At this stage, if no listener sets a response on the event, then an exception
391391
is thrown: either the controller *or* one of the view listeners must always
392392
return a ``Response``.
393393

394+
.. note::
395+
396+
When setting a response for the ``kernel.view`` event, the propagation
397+
is stopped, so the lower priority listeners on that event don't get called.
398+
394399
.. sidebar:: ``kernel.view`` in the Symfony Framework
395400

396401
There is no default listener inside the Symfony Framework for the ``kernel.view``
@@ -522,6 +527,11 @@ comes with an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionLi
522527
which if you choose to use, will do this and more by default (see the sidebar
523528
below for more details).
524529

530+
.. note::
531+
532+
When setting a response for the ``kernel.exception`` event, the propagation
533+
is stopped, so the lower priority listeners on that event don't get called.
534+
525535
.. sidebar:: ``kernel.exception`` in the Symfony Framework
526536

527537
There are two main listeners to ``kernel.exception`` when using the

cookbook/service_container/event_listener.rst

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ event is just one of the core kernel events::
5757
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
5858
To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`.
5959

60+
.. note::
61+
62+
When setting a response for the ``kernel.view`` or ``kernel.exception``
63+
events, the propagation is stopped, so the lower priority listeners on
64+
that event don't get called.
65+
6066
Now that the class is created, you just need to register it as a service and
6167
notify Symfony that it is a "listener" on the ``kernel.exception`` event by
6268
using a special "tag":

0 commit comments

Comments
 (0)