function DrupalKernel::attachSynthetic

Same name and namespace 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. 10 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 The container object with the kernel and the class loader added.

2 calls to DrupalKernel::attachSynthetic()
DrupalKernel::initializeContainer in core/lib/Drupal/Core/DrupalKernel.php
Initializes the service container.
InstallerKernel::attachSynthetic in core/lib/Drupal/Core/Installer/InstallerKernel.php
Attach synthetic values on to kernel.
1 method overrides DrupalKernel::attachSynthetic()
InstallerKernel::attachSynthetic in core/lib/Drupal/Core/Installer/InstallerKernel.php
Attach synthetic values on to kernel.

File

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

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.