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

Breadcrumb

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

function RequestStack::getMainRequest

Gets the main request.

Be warned that making your code aware of the main request might make it un-compatible with other features of your framework like ESI support.

2 calls to RequestStack::getMainRequest()
VirtualRequestStack::getMainRequest in vendor/symfony/http-kernel/Debug/VirtualRequestStack.php
Gets the main request.
VirtualRequestStack::getMainRequest in vendor/symfony/http-kernel/Debug/VirtualRequestStack.php
Gets the main request.
1 method overrides RequestStack::getMainRequest()
VirtualRequestStack::getMainRequest in vendor/symfony/http-kernel/Debug/VirtualRequestStack.php
Gets the main request.

File

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

Class

RequestStack
Request stack that controls the lifecycle of requests.

Namespace

Symfony\Component\HttpFoundation

Code

public function getMainRequest() : ?Request {
    if (!$this->requests) {
        return null;
    }
    return $this->requests[0];
}

API Navigation

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