You are here

private function ReplaceAliasByActualDefinitionPass::updateReferences in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php \Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass::updateReferences()

Updates references to remove aliases.

Parameters

ContainerBuilder $container The container:

string $currentId The alias identifier being replaced:

string $newId The id of the service the alias points to:

1 call to ReplaceAliasByActualDefinitionPass::updateReferences()
ReplaceAliasByActualDefinitionPass::process in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php
Process the Container to replace aliases with service definitions.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php, line 76

Class

ReplaceAliasByActualDefinitionPass
Replaces aliases with actual service definitions, effectively removing these aliases.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function updateReferences($container, $currentId, $newId) {
  foreach ($container
    ->getAliases() as $id => $alias) {
    if ($currentId === (string) $alias) {
      $container
        ->setAlias($id, $newId);
    }
  }
  foreach ($container
    ->getDefinitions() as $id => $definition) {
    $this->sourceId = $id;
    $definition
      ->setArguments($this
      ->updateArgumentReferences($definition
      ->getArguments(), $currentId, $newId));
    $definition
      ->setMethodCalls($this
      ->updateArgumentReferences($definition
      ->getMethodCalls(), $currentId, $newId));
    $definition
      ->setProperties($this
      ->updateArgumentReferences($definition
      ->getProperties(), $currentId, $newId));
  }
}