Skip to content

Commit dd46bcd

Browse files
committed
Minor tweaks
1 parent cf6bc3d commit dd46bcd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

cookbook/event_dispatcher/event_listener.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ The most common way to listen to an event is to register an **event listener**::
6464

6565
Each event receives a slightly different type of ``$event`` object. For
6666
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
67-
To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`.
67+
To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`
68+
or the documentation about the specific even you're listening to.
6869

6970
Now that the class is created, you just need to register it as a service and
7071
notify Symfony that it is a "listener" on the ``kernel.exception`` event by
@@ -220,9 +221,9 @@ Request Events, Checking Types
220221
------------------------------
221222

222223
A single page can make several requests (one master request, and then multiple
223-
sub-requests), which is why when working with the ``KernelEvents::REQUEST``
224-
event, you might need to check the type of the request. This can be easily
225-
done as follow::
224+
sub-requests - typically by :ref:`templating-embedding-controller`). For the core
225+
Symfony events, you might need to check to see if the event is for a "master" request
226+
or a "sub request":
226227

227228
// src/AppBundle/EventListener/RequestListener.php
228229
namespace AppBundle\EventListener;
@@ -244,11 +245,8 @@ done as follow::
244245
}
245246
}
246247

247-
.. tip::
248-
249-
Two types of request are available in the :class:`Symfony\\Component\\HttpKernel\\HttpKernelInterface`
250-
interface: ``HttpKernelInterface::MASTER_REQUEST`` and
251-
``HttpKernelInterface::SUB_REQUEST``.
248+
Certain things, like checking information on the *real* request, may not need to
249+
be done on the sub-request listeners.
252250

253251
Events or Subscribers
254252
---------------------

0 commit comments

Comments
 (0)