public function DrupalKernel::prepareLegacyRequest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::prepareLegacyRequest()
Prepare the kernel for handling a request without handling the request.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
Return value
$this
Overrides DrupalKernelInterface::prepareLegacyRequest
Deprecated
8.x Only used by legacy front-controller scripts.
File
- core/
lib/ Drupal/ Core/ DrupalKernel.php, line 685 - Contains \Drupal\Core\DrupalKernel.
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
public function prepareLegacyRequest(Request $request) {
$this
->boot();
$this
->preHandle($request);
// Setup services which are normally initialized from within stack
// middleware or during the request kernel event.
if (PHP_SAPI !== 'cli') {
$request
->setSession($this->container
->get('session'));
}
$request->attributes
->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
$request->attributes
->set(RouteObjectInterface::ROUTE_NAME, '<none>');
$this->container
->get('request_stack')
->push($request);
$this->container
->get('router.request_context')
->fromRequest($request);
return $this;
}