public function ResolveDefinitionTemplatesPass::process

Process the ContainerBuilder to replace DefinitionDecorator instances with their real Definition instances.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

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

Class

ResolveDefinitionTemplatesPass
This replaces all DefinitionDecorator instances with their equivalent fully merged Definition instance.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  $this->container = $container;
  $this->compiler = $container
    ->getCompiler();
  $this->formatter = $this->compiler
    ->getLoggingFormatter();
  foreach (array_keys($container
    ->getDefinitions()) as $id) {

    // yes, we are specifically fetching the definition from the
    // container to ensure we are not operating on stale data
    $definition = $container
      ->getDefinition($id);
    if (!$definition instanceof DefinitionDecorator || $definition
      ->isAbstract()) {
      continue;
    }
    $this
      ->resolveDefinition($id, $definition);
  }
}