function ReverseContainer::recordContainer

Same name in other branches
  1. 10 core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::recordContainer()
  2. 11.x core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::recordContainer()

Records a map of the container's services.

This method is used so that stale services can be serialized after a container has been re-initialized.

File

core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php, line 82

Class

ReverseContainer
Retrieves service IDs from the container for public services.

Namespace

Drupal\Component\DependencyInjection

Code

public function recordContainer() : void {
    $service_recorder = \Closure::bind(function () : array {
        return array_filter($this->services, 'is_object');
    }, $this->serviceContainer, $this->serviceContainer);
    self::$recordedServices = array_merge(self::$recordedServices, array_flip(array_map([
        $this,
        'generateServiceIdHash',
    ], $service_recorder())));
}

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