You are here

private function ContainerBuilder::synchronize in Service Container 7.2

Same name in this branch
  1. 7.2 lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::synchronize()
  2. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::synchronize()
Same name and namespace in other branches
  1. 7 lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::synchronize()

Synchronizes a service change.

This method is a copy of the ContainerBuilder of symfony.

This method updates all services that depend on the given service by calling all methods referencing it.

Parameters

string $id A service id:

Overrides ContainerBuilder::synchronize

File

lib/Drupal/Core/DependencyInjection/ContainerBuilder.php, line 85
Contains \Drupal\Core\DependencyInjection\ContainerBuilder.

Class

ContainerBuilder
Drupal's dependency injection container builder.

Namespace

Drupal\Core\DependencyInjection

Code

private function synchronize($id) {
  foreach ($this
    ->getDefinitions() as $definitionId => $definition) {

    // only check initialized services
    if (!$this
      ->initialized($definitionId)) {
      continue;
    }
    foreach ($definition
      ->getMethodCalls() as $call) {
      foreach ($call[1] as $argument) {
        if ($argument instanceof Reference && $id == (string) $argument) {
          $this
            ->callMethod($this
            ->get($definitionId), $call);
        }
      }
    }
  }
}