You are here

protected function DrupalKernel::attachSynthetic in Drupal 9

Same name and namespace in other branches
  1. 8 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 1180

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;
}