W3cubDocs

/Drupal 8

protected function DrupalKernel::persistServices

protected DrupalKernel::persistServices(ContainerInterface $container, array $persist)

Moves persistent service instances into a new container.

File

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::persistServices/8.1.x