You are here

public function ResolveReferencesToAliasesPass::process in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php \Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass::process()

Processes the ContainerBuilder to replace references to aliases with actual service references.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php, line 33

Class

ResolveReferencesToAliasesPass
Replaces all references to aliases with references to the actual service.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  $this->container = $container;
  foreach ($container
    ->getDefinitions() as $definition) {
    if ($definition
      ->isSynthetic() || $definition
      ->isAbstract()) {
      continue;
    }
    $definition
      ->setArguments($this
      ->processArguments($definition
      ->getArguments()));
    $definition
      ->setMethodCalls($this
      ->processArguments($definition
      ->getMethodCalls()));
    $definition
      ->setProperties($this
      ->processArguments($definition
      ->getProperties()));
  }
  foreach ($container
    ->getAliases() as $id => $alias) {
    $aliasId = (string) $alias;
    if ($aliasId !== ($defId = $this
      ->getDefinitionId($aliasId))) {
      $container
        ->setAlias($id, new Alias($defId, $alias
        ->isPublic()));
    }
  }
}