You are here

abstract class SessionListener in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/SessionListener.php \Symfony\Component\HttpKernel\EventListener\SessionListener

Sets the session in the request.

@author Johannes M. Schmitt <schmittjoh@gmail.com>

Hierarchy

Expanded class hierarchy of SessionListener

File

vendor/symfony/http-kernel/EventListener/SessionListener.php, line 23

Namespace

Symfony\Component\HttpKernel\EventListener
View source
abstract class SessionListener implements EventSubscriberInterface {
  public function onKernelRequest(GetResponseEvent $event) {
    if (!$event
      ->isMasterRequest()) {
      return;
    }
    $request = $event
      ->getRequest();
    $session = $this
      ->getSession();
    if (null === $session || $request
      ->hasSession()) {
      return;
    }
    $request
      ->setSession($session);
  }
  public static function getSubscribedEvents() {
    return array(
      KernelEvents::REQUEST => array(
        'onKernelRequest',
        128,
      ),
    );
  }

  /**
   * Gets the session object.
   *
   * @return SessionInterface|null A SessionInterface instance or null if no session is available
   */
  protected abstract function getSession();

}

Members

Namesort descending Modifiers Type Description Overrides
SessionListener::getSession abstract protected function Gets the session object.
SessionListener::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface::getSubscribedEvents
SessionListener::onKernelRequest public function