You are here

private function ContainerBuilder::synchronize in Service Container 7

Same name in this branch
  1. 7 lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::synchronize()
  2. 7 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.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::synchronize()

Synchronizes a service change.

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

Parameters

string $id A service id:

Deprecated

since version 2.7, will be removed in 3.0.

1 call to ContainerBuilder::synchronize()
ContainerBuilder::set in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php
Sets a service.
1 method overrides ContainerBuilder::synchronize()
ContainerBuilder::synchronize in lib/Drupal/Core/DependencyInjection/ContainerBuilder.php
Synchronizes a service change.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 1127

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

private function synchronize($id) {
  if ('request' !== $id) {
    trigger_error('The ' . __METHOD__ . ' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
  }
  foreach ($this->definitions 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);
        }
      }
    }
  }
}