You are here

public function RequestStack::getParentRequest in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Symfony/Component/HttpFoundation/RequestStack.php \Symfony\Component\HttpFoundation\RequestStack::getParentRequest()

Returns the parent request of the current.

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

If current Request is the master request, it returns null.

Return value

Request|null

File

lib/Symfony/Component/HttpFoundation/RequestStack.php, line 93

Class

RequestStack
Request stack that controls the lifecycle of requests.

Namespace

Symfony\Component\HttpFoundation

Code

public function getParentRequest() {
  $pos = count($this->requests) - 2;
  if (!isset($this->requests[$pos])) {
    return;
  }
  return $this->requests[$pos];
}