Skip to content

Commit cd820d7

Browse files
committed
Proofreading after #4901
1 parent cd025f8 commit cd820d7

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

cookbook/profiler/profiling_data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ this token is available in the ``X-Debug-Token`` HTTP header of the response.
2020
Using this token, you can access the profile of any past response thanks to the
2121
:method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::loadProfile` method::
2222

23-
$token = $request->headers->get('X-Debug-Token');
23+
$token = $response->headers->get('X-Debug-Token');
2424
$profile = $container->get('profiler')->loadProfile($token);
2525

2626
.. tip::

reference/dic_tags.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ cookbook entry.
549549
For another practical example of a kernel listener, see the cookbook
550550
article: :doc:`/cookbook/request/mime_type`.
551551

552+
Core Event Listener Reference
553+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
554+
552555
For the reference of Event Listeners associated with each kernel event, see the
553556
:doc:`Symfony Events Reference </reference/events>`.
554557

reference/events.rst

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Symfony Framework Events
22
========================
33

4+
When the Symfony Framework (or anything using the :class:`Symfony\\Component\\HttpKernel\\HttpKernel`)
5+
handles a request, a few core events are dispatched so that you can add listeners
6+
throughout the process. These are called the "kernel events". For a larger
7+
explanation, see :doc:`/reference/http_kernel/introduction`.
8+
49
Kernel Events
510
-------------
611

@@ -20,22 +25,13 @@ each event has access to the following information:
2025

2126
.. _kernel-core-request:
2227

23-
``kernel.request``
24-
~~~~~~~~~~~~~~~~~~
28+
kernel.request
29+
~~~~~~~~~~~~~~
2530

2631
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent`
2732

28-
The goal of this event is to either return a ``Response`` object immediately
29-
or setup variables so that a Controller can be called after the event. Any
30-
listener can return a ``Response`` object via the ``setResponse()`` method on
31-
the event. In this case, all other listeners won't be called.
32-
33-
This event is used by the FrameworkBundle to populate the ``_controller``
34-
``Request`` attribute, via the
35-
:class:`Symfony\\Bundle\\FrameworkBundle\\EventListener\\RouterListener`.
36-
RequestListener uses a :class:`Symfony\\Component\\Routing\\RouterInterface`
37-
object to match the ``Request`` and determine the Controller name (stored in the
38-
``_controller`` ``Request`` attribute).
33+
This event is dispatched very early in Symfony, before the controller is
34+
determined.
3935

4036
.. seealso::
4137

@@ -54,7 +50,7 @@ Listener Class Name P
5450
:class:`Symfony\\Component\\Security\\Http\\Firewall` 8
5551
============================================================================= ========
5652

57-
``kernel.controller``
53+
kernel.controller
5854
~~~~~~~~~~~~~~~~~~~~~
5955

6056
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent`
@@ -84,8 +80,8 @@ Listener Class Name
8480
:class:`Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RequestDataCollector` 0
8581
============================================================================== ========
8682

87-
``kernel.view``
88-
~~~~~~~~~~~~~~~
83+
kernel.view
84+
~~~~~~~~~~~
8985

9086
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent`
9187

@@ -114,8 +110,8 @@ method::
114110

115111
Read more on the :ref:`kernel.view event <component-http-kernel-kernel-view>`.
116112

117-
``kernel.response``
118-
~~~~~~~~~~~~~~~~~~~
113+
kernel.response
114+
~~~~~~~~~~~~~~~
119115

120116
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent`
121117

@@ -162,8 +158,8 @@ Listener Class Name
162158
:class:`Symfony\\Component\\HttpKernel\\EventListener\\StreamedResponseListener` -1024
163159
=================================================================================== ========
164160

165-
``kernel.terminate``
166-
~~~~~~~~~~~~~~~~~~~~
161+
kernel.terminate
162+
~~~~~~~~~~~~~~~~
167163

168164
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent`
169165

@@ -185,8 +181,8 @@ Listener Class Name Prior
185181

186182
.. _kernel-kernel.exception:
187183

188-
``kernel.exception``
189-
~~~~~~~~~~~~~~~~~~~~
184+
kernel.exception
185+
~~~~~~~~~~~~~~~~
190186

191187
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`
192188

@@ -219,7 +215,7 @@ and set a new ``Exception`` object, or do nothing::
219215
response won't work. If you want to overwrite the status code (which you
220216
should not without a good reason), set the ``X-Status-Code`` header::
221217

222-
return new Response(
218+
$response = Response(
223219
'Error',
224220
404 // ignored,
225221
array('X-Status-Code' => 200)

0 commit comments

Comments
 (0)