Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GetResponseForExceptionEvent is deprecated in favor of ExceptionEvent #11698

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

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 5 additions & 5 deletions event_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ The most common way to listen to an event is to register an **event listener**::
namespace App\EventListener;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class ExceptionListener
{
public function onKernelException(GetResponseForExceptionEvent $event)
public function onKernelException(ExceptionEvent $event)
{
// You get the exception object from the received event
$exception = $event->getException();
Expand Down Expand Up @@ -63,7 +63,7 @@ The most common way to listen to an event is to register an **event listener**::
.. tip::

Each event receives a slightly different type of ``$event`` object. For
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent`.
Check out the :doc:`Symfony events reference </reference/events>` to see
what type of object each event provides.

Expand Down Expand Up @@ -207,11 +207,11 @@ or a "sub request"::
// src/EventListener/RequestListener.php
namespace App\EventListener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;

class RequestListener
{
public function onKernelRequest(GetResponseEvent $event)
public function onKernelRequest(ExceptionEvent $event)
{
if (!$event->isMasterRequest()) {
// don't do anything if it's not the master request
Expand Down