Skip to content

[HttpKernel] PostResponseEvent should extend the KernelEvent #16430

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 1 commit into from
Nov 4, 2015
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
39 changes: 6 additions & 33 deletions src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,26 @@
namespace Symfony\Component\HttpKernel\Event;

use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
* Allows to execute logic after a response was sent.
*
* Since it's only triggered on master requests, the `getRequestType()` method
* will always return the value of `HttpKernelInterface::MASTER_REQUEST`.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class PostResponseEvent extends Event
class PostResponseEvent extends KernelEvent
{
/**
* The kernel in which this event was thrown.
*
* @var HttpKernelInterface
*/
private $kernel;

private $request;

private $response;

public function __construct(HttpKernelInterface $kernel, Request $request, Response $response)
{
$this->kernel = $kernel;
$this->request = $request;
$this->response = $response;
}
parent::__construct($kernel, $request, HttpKernelInterface::MASTER_REQUEST);

/**
* Returns the kernel in which this event was thrown.
*
* @return HttpKernelInterface
*/
public function getKernel()
{
return $this->kernel;
}

/**
* Returns the request for which this event was thrown.
*
* @return Request
*/
public function getRequest()
{
return $this->request;
$this->response = $response;
}

/**
Expand Down