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