Skip to content

Kernel Events Proofreading after #4901 #5297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cookbook/profiler/profiling_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ this token is available in the ``X-Debug-Token`` HTTP header of the response.
Using this token, you can access the profile of any past response thanks to the
:method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::loadProfile` method::

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

.. tip::
Expand Down
3 changes: 3 additions & 0 deletions reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ cookbook entry.
For another practical example of a kernel listener, see the cookbook
article: :doc:`/cookbook/request/mime_type`.

Core Event Listener Reference
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For the reference of Event Listeners associated with each kernel event, see the
:doc:`Symfony Events Reference </reference/events>`.

Expand Down
20 changes: 8 additions & 12 deletions reference/events.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Symfony Framework Events
========================

When the Symfony Framework (or anything using the :class:`Symfony\\Component\\HttpKernel\\HttpKernel`)
handles a request, a few core events are dispatched so that you can add listeners
throughout the process. These are called the "kernel events". For a larger
explanation, see :doc:`/components/http_kernel/introduction`.

Kernel Events
-------------

Expand All @@ -25,17 +30,8 @@ each event has access to the following information:

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

The goal of this event is to either return a ``Response`` object immediately
or setup variables so that a Controller can be called after the event. Any
listener can return a ``Response`` object via the ``setResponse()`` method on
the event. In this case, all other listeners won't be called.

This event is used by the FrameworkBundle to populate the ``_controller``
``Request`` attribute, via the
:class:`Symfony\\Bundle\\FrameworkBundle\\EventListener\\RouterListener`.
RequestListener uses a :class:`Symfony\\Component\\Routing\\RouterInterface`
object to match the ``Request`` and determine the Controller name (stored in the
``_controller`` ``Request`` attribute).
This event is dispatched very early in Symfony, before the controller is
determined.

.. seealso::

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

return new Response(
$response = Response(
'Error',
404 // ignored,
array('X-Status-Code' => 200)
Expand Down