function DrupalKernel::prepareLegacyRequest

Overrides DrupalKernelInterface::prepareLegacyRequest

File

core/lib/Drupal/Core/DrupalKernel.php, line 759

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

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);
    @trigger_error(__NAMESPACE__ . '\\DrupalKernel::prepareLegacyRequest is deprecated drupal:8.0.0 and is removed from drupal:9.0.0. Use DrupalKernel::boot() and DrupalKernel::preHandle() instead. See https://www.drupal.org/node/3070678', E_USER_DEPRECATED);
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.