function DrupalKernel::getServicesToPersist

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

Returns service instances to persist from an old container to a new one.

1 call to DrupalKernel::getServicesToPersist()
DrupalKernel::attachSynthetic in core/lib/Drupal/Core/DrupalKernel.php
Attach synthetic values on to kernel.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function getServicesToPersist(ContainerInterface $container) {
    $persist = [];
    foreach ($container->getParameter('persist_ids') as $id) {
        // It's pointless to persist services not yet initialized.
        if ($container->initialized($id)) {
            $persist[$id] = $container->get($id);
        }
    }
    return $persist;
}

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