Skip to content
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

Missing reference docs for kernel.finish_request event #6174

Merged
merged 1 commit into from
Jan 30, 2016
Merged
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
29 changes: 29 additions & 0 deletions reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,35 @@ Listener Class Name
:class:`Symfony\\Component\\HttpKernel\\EventListener\\StreamedResponseListener` -1024
=================================================================================== ========

``kernel.finish_request``
~~~~~~~~~~~~~~~~~~~~~~~~~

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

The purpose of this event is to allow you to reset the global and environmental state of
the application after a sub-request has finished::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to change this to "after a sub-request has finished. For example, the translator listener uses it to reset the locale to the locale of the parent request:". However, that can also be done by us after merging, so don't worry if you have no time to update the PR.


public function onKernelFinishRequest(FinishRequestEvent $event)
{
if (null === $parentRequest = $this->requestStack->getParentRequest()) {
return;
}

//Reset the locale of the subrequest to the locale of the parent request
$this->setLocale($parentRequest);
}

These are the built-in Symfony listeners related to this event:

========================================================================== ========
Listener Class Name Priority
========================================================================== ========
:class:`Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener` 0
:class:`Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener` 0
:class:`Symfony\\Component\\HttpKernel\\EventListener\\RouterListener` 0
:class:`Symfony\\Component\\Security\\Http\\Firewall` 0
========================================================================== ========

``kernel.terminate``
~~~~~~~~~~~~~~~~~~~~

Expand Down