public DrupalKernel::prepareLegacyRequest(Request $request)
Prepare the kernel for handling a request without handling the request.
\Symfony\Component\HttpFoundation\Request $request: The current request.
$this
Overrides DrupalKernelInterface::prepareLegacyRequest
in Drupal 8.0.x and will be removed before 9.0.0. Only used by legacy front-controller scripts.
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;
}
© 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!DrupalKernel.php/function/DrupalKernel::prepareLegacyRequest/8.1.x