public function ReplaceAliasByActualDefinitionPass::process

Process the Container to replace aliases with service definitions.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php, line 34

Class

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

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  $this->compiler = $container
    ->getCompiler();
  $this->formatter = $this->compiler
    ->getLoggingFormatter();
  foreach ($container
    ->getAliases() as $id => $alias) {
    $aliasId = (string) $alias;
    $definition = $container
      ->getDefinition($aliasId);
    if ($definition
      ->isPublic()) {
      continue;
    }
    $definition
      ->setPublic(true);
    $container
      ->setDefinition($id, $definition);
    $container
      ->removeDefinition($aliasId);
    $this
      ->updateReferences($container, $aliasId, $id);

    // we have to restart the process due to concurrent modification of
    // the container
    $this
      ->process($container);
    break;
  }
}