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

Breadcrumb

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

function RequestStack::getSession

Gets the current session.

Throws

SessionNotFoundException

File

vendor/symfony/http-foundation/RequestStack.php, line 109

Class

RequestStack
Request stack that controls the lifecycle of requests.

Namespace

Symfony\Component\HttpFoundation

Code

public function getSession() : SessionInterface {
    if (null !== ($request = end($this->requests) ?: null) && $request->hasSession()) {
        return $request->getSession();
    }
    throw new SessionNotFoundException();
}

API Navigation

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