function DrupalKernel::attachSynthetic

Same name in other branches
  1. 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::attachSynthetic()
  2. 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::attachSynthetic()
  3. 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::attachSynthetic()

Attach synthetic values on to kernel.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: Container object

Return value

\Symfony\Component\DependencyInjection\ContainerInterface

1 call to DrupalKernel::attachSynthetic()
DrupalKernel::initializeContainer in core/lib/Drupal/Core/DrupalKernel.php
Initializes the service container.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function attachSynthetic(ContainerInterface $container) {
    $persist = [];
    if (isset($this->container)) {
        $persist = $this->getServicesToPersist($this->container);
    }
    $this->persistServices($container, $persist);
    // All namespaces must be registered before we attempt to use any service
    // from the container.
    $this->classLoaderAddMultiplePsr4($container->getParameter('container.namespaces'));
    $container->set('kernel', $this);
    // Set the class loader which was registered as a synthetic service.
    $container->set('class_loader', $this->classLoader);
    return $container;
}

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