You are here

public function ResolveReferencesToAliasesPass::process in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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()));
    }
  }
}