You are here

public function SaveSessionListener::onKernelResponse in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/SaveSessionListener.php \Symfony\Component\HttpKernel\EventListener\SaveSessionListener::onKernelResponse()

File

vendor/symfony/http-kernel/EventListener/SaveSessionListener.php, line 47

Class

SaveSessionListener
Saves the session, in case it is still open, before sending the response/headers.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function onKernelResponse(FilterResponseEvent $event) {
  if (!$event
    ->isMasterRequest()) {
    return;
  }
  $session = $event
    ->getRequest()
    ->getSession();
  if ($session && $session
    ->isStarted()) {
    $session
      ->save();
  }
}