Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Session.php

function Session::initializePersistentSession

Initializes a session backed by persistent store and puts it on the request.

Sessions for web requests need to be backed by a persistent session store and a real session handler (responsible for session cookie management). In contrast, a simple in-memory store is sufficient for command line tools and tests. Hence, the persistent session should only ever be placed on web requests while command line tools and the parent site in functional tests must continue to use the ephemeral session initialized in DrupalKernel::preHandle().

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

See also

\Drupal\Core\DrupalKernel::preHandle()

1 call to Session::initializePersistentSession()
Session::handle in core/lib/Drupal/Core/StackMiddleware/Session.php
Handles a Request to convert it to a Response.

File

core/lib/Drupal/Core/StackMiddleware/Session.php, line 78

Class

Session
Wrap session logic around a HTTP request.

Namespace

Drupal\Core\StackMiddleware

Code

protected function initializePersistentSession(Request $request) : void {
    
    /** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */
    $session = ($this->sessionClosure)();
    $session->start();
    $request->setSession($session);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal