You are here

public function ContainerBuilder::compile in Zircon Profile 8

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

Compiles the container.

This method passes the container to compiler passes whose job is to manipulate and optimize the container.

The main compiler passes roughly do four things:

  • The extension configurations are merged;
  • Parameter values are resolved;
  • The parameter bag is frozen;
  • Extension loading is disabled.

File

vendor/symfony/dependency-injection/ContainerBuilder.php, line 560

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function compile() {
  $compiler = $this
    ->getCompiler();
  if ($this->trackResources) {
    foreach ($compiler
      ->getPassConfig()
      ->getPasses() as $pass) {
      $this
        ->addObjectResource($pass);
    }
  }
  $compiler
    ->compile($this);
  if ($this->trackResources) {
    foreach ($this->definitions as $definition) {
      if ($definition
        ->isLazy() && ($class = $definition
        ->getClass()) && class_exists($class)) {
        $this
          ->addClassResource(new \ReflectionClass($class));
      }
    }
  }
  $this->extensionConfigs = array();
  parent::compile();
}