class GetResponseEvent

Allows to create a response for a request

Call setResponse() to set the response that will be returned for the current request. The propagation of this event is stopped as soon as a response is set.

@author Bernhard Schussek <bschussek@gmail.com>

@api

Hierarchy

Expanded class hierarchy of GetResponseEvent

29 files declare their use of GetResponseEvent
AccessSubscriber.php in drupal/core/lib/Drupal/Core/EventSubscriber/AccessSubscriber.php
Contains Drupal\Core\EventSubscriber\AccessSubscriber.
AjaxSubscriber.php in drupal/core/lib/Drupal/Core/Ajax/AjaxSubscriber.php
Contains \Drupal\Core\Ajax\AjaxSubscriber.
BanSubscriber.php in drupal/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
Definition of Drupal\ban\EventSubscriber\BanSubscriber.
FormTestEventSubscriber.php in drupal/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/EventSubscriber/FormTestEventSubscriber.php
Contains \Drupal\form_test\EventSubscriber\FormTestEventSubscriber.
FragmentListener.php in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/FragmentListener.php

... See full list

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseEvent.php, line 27

Namespace

Symfony\Component\HttpKernel\Event
View source
class GetResponseEvent extends KernelEvent {

  /**
   * The response object
   * @var Response
   */
  private $response;

  /**
   * Returns the response object
   *
   * @return Response
   *
   * @api
   */
  public function getResponse() {
    return $this->response;
  }

  /**
   * Sets a response and stops event propagation
   *
   * @param Response $response
   *
   * @api
   */
  public function setResponse(Response $response) {
    $this->response = $response;
    $this
      ->stopPropagation();
  }

  /**
   * Returns whether a response was set
   *
   * @return Boolean Whether a response was set
   *
   * @api
   */
  public function hasResponse() {
    return null !== $this->response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher public function Returns the EventDispatcher that dispatches this Event
Event::getName public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher public function Stores the EventDispatcher that dispatches this Event
Event::setName public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.
GetResponseEvent::$response private property The response object
GetResponseEvent::getResponse public function Returns the response object
GetResponseEvent::hasResponse public function Returns whether a response was set
GetResponseEvent::setResponse public function Sets a response and stops event propagation
KernelEvent::$kernel private property The kernel in which this event was thrown
KernelEvent::$request private property The request the kernel is currently processing
KernelEvent::$requestType private property The request type the kernel is currently processing. One of HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST
KernelEvent::getKernel public function Returns the kernel in which this event was thrown
KernelEvent::getRequest public function Returns the request the kernel is currently processing
KernelEvent::getRequestType public function Returns the request type the kernel is currently processing
KernelEvent::__construct public function 4