function DrupalKernel::persistServices

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

Moves persistent service instances into a new container.

2 calls to DrupalKernel::persistServices()
DrupalKernel::attachSynthetic in core/lib/Drupal/Core/DrupalKernel.php
Attach synthetic values on to kernel.
DrupalKernel::resetContainer in core/lib/Drupal/Core/DrupalKernel.php
Force a container reset.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function persistServices(ContainerInterface $container, array $persist) {
    foreach ($persist as $id => $object) {
        // Do not override services already set() on the new container, for
        // example 'service_container'.
        if (!$container->initialized($id)) {
            $container->set($id, $object);
        }
    }
}

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