W3cubDocs

/Drupal 8

public function SessionManager::__construct

public SessionManager::__construct(RequestStack $request_stack, Connection $connection, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, $handler = NULL)

Constructs a new session manager instance.

Parameters

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.

\Drupal\Core\Database\Connection $connection: The database connection.

\Drupal\Core\Session\MetadataBag $metadata_bag: The session metadata bag.

\Drupal\Core\Session\SessionConfigurationInterface $session_configuration: The session configuration interface.

\Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy|Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler|\SessionHandlerInterface|NULL $handler: The object to register as a PHP session handler. @see \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::setSaveHandler()

Overrides NativeSessionStorage::__construct

File

core/lib/Drupal/Core/Session/SessionManager.php, line 85

Class

SessionManager
Manages user sessions.

Namespace

Drupal\Core\Session

Code

public function __construct(RequestStack $request_stack, Connection $connection, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, $handler = NULL) {
  $options = array();
  $this->sessionConfiguration = $session_configuration;
  $this->requestStack = $request_stack;
  $this->connection = $connection;

  parent::__construct($options, $handler, $metadata_bag);

  // @todo When not using the Symfony Session object, the list of bags in the
  //   NativeSessionStorage will remain uninitialized. This will lead to
  //   errors in NativeSessionHandler::loadSession. Remove this after
  //   https://www.drupal.org/node/2229145, when we will be using the Symfony
  //   session object (which registers an attribute bag with the
  //   manager upon instantiation).
  $this->bags = array();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Session!SessionManager.php/function/SessionManager::__construct/8.1.x