Skip to content

Commit e48cfb7

Browse files
committed
Use ResponseEvent instead of deprecated FilterResponseEvent
1 parent 02be27b commit e48cfb7

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

components/event_dispatcher.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Often times, data about a specific event needs to be passed along with the
111111
case, a special subclass that has additional methods for retrieving and
112112
overriding information can be passed when dispatching an event. For example,
113113
the ``kernel.response`` event uses a
114-
:class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent`, which
114+
:class:`Symfony\\Component\\HttpKernel\\Event\\ResponseEvent`, which
115115
contains methods to get and even replace the ``Response`` object.
116116

117117
The Dispatcher
@@ -334,7 +334,7 @@ Take the following example of a subscriber that subscribes to the
334334

335335
use Acme\Store\Event\OrderPlacedEvent;
336336
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
337-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
337+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
338338
use Symfony\Component\HttpKernel\KernelEvents;
339339

340340
class StoreSubscriber implements EventSubscriberInterface
@@ -350,12 +350,12 @@ Take the following example of a subscriber that subscribes to the
350350
];
351351
}
352352

353-
public function onKernelResponsePre(FilterResponseEvent $event)
353+
public function onKernelResponsePre(ResponseEvent $event)
354354
{
355355
// ...
356356
}
357357

358-
public function onKernelResponsePost(FilterResponseEvent $event)
358+
public function onKernelResponsePost(ResponseEvent $event)
359359
{
360360
// ...
361361
}

components/http_kernel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ kernel.request ``KernelEvents::REQUEST`` :class:`Sym
609609
kernel.controller ``KernelEvents::CONTROLLER`` :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent`
610610
kernel.controller_arguments ``KernelEvents::CONTROLLER_ARGUMENTS`` :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent`
611611
kernel.view ``KernelEvents::VIEW`` :class:`Symfony\\Component\\HttpKernel\\Event\\ViewEvent`
612-
kernel.response ``KernelEvents::RESPONSE`` :class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent`
612+
kernel.response ``KernelEvents::RESPONSE`` :class:`Symfony\\Component\\HttpKernel\\Event\\ResponseEvent`
613613
kernel.finish_request ``KernelEvents::FINISH_REQUEST`` :class:`Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent`
614614
kernel.terminate ``KernelEvents::TERMINATE`` :class:`Symfony\\Component\\HttpKernel\\Event\\TerminateEvent`
615615
kernel.exception ``KernelEvents::EXCEPTION`` :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent`

event_dispatcher/before_after_filters.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ This will look for the ``auth_token`` flag on the request object and set a custo
208208
header on the response if it's found::
209209

210210
// add the new use statement at the top of your file
211-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
211+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
212212

213-
public function onKernelResponse(FilterResponseEvent $event)
213+
public function onKernelResponse(ResponseEvent $event)
214214
{
215215
// check to see if onKernelController marked this as a token "auth'ed" request
216216
if (!$token = $event->getRequest()->attributes->get('auth_token')) {

profiler.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ production. To do that, create an :doc:`event subscriber </event_dispatcher>`
197197
and listen to the :ref:`kernel.response<component-http-kernel-kernel-response>`
198198
event::
199199

200-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
200+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
201201

202202
// ...
203203

204-
public function onKernelResponse(FilterResponseEvent $event)
204+
public function onKernelResponse(ResponseEvent $event)
205205
{
206206
if (!$this->getKernel()->isDebug()) {
207207
return;

reference/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ their priorities:
143143
``kernel.response``
144144
~~~~~~~~~~~~~~~~~~~
145145

146-
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent`
146+
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\ResponseEvent`
147147

148148
This event is dispatched after the controller or any ``kernel.view`` listener
149149
returns a ``Response`` object. It's useful to modify or replace the response
150150
before sending it back (e.g. add/modify HTTP headers, add cookies, etc.)::
151151

152-
public function onKernelResponse(FilterResponseEvent $event)
152+
public function onKernelResponse(ResponseEvent $event)
153153
{
154154
$response = $event->getResponse();
155155

service_container/3.3-di-changes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,12 @@ create the class::
373373
// ...
374374

375375
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
376-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
376+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
377377
use Symfony\Component\HttpKernel\KernelEvents;
378378

379379
class SetHeaderSusbcriber implements EventSubscriberInterface
380380
{
381-
public function onKernelResponse(FilterResponseEvent $event)
381+
public function onKernelResponse(ResponseEvent $event)
382382
{
383383
$event->getResponse()->headers->set('X-SYMFONY-3.3', 'Less config');
384384
}

0 commit comments

Comments
 (0)