You are here

public function ResolveDefinitionTemplatesPass::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/ResolveDefinitionTemplatesPass.php \Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass::process()

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

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

modules/providers/service_container_symfony/lib/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 ($container
    ->getDefinitions() as $id => $definition) {

    // 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);
  }
}