You are here

private function ReplaceAliasByActualDefinitionPass::updateReferences in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/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 vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php
Process the Container to replace aliases with service definitions.

File

vendor/symfony/dependency-injection/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));
  }
}