public function 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.

@api

Overrides Container::compile

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 439

Class

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

Namespace

Symfony\Component\DependencyInjection

Code

public function compile() {
  if (null === $this->compiler) {
    $this->compiler = new Compiler();
  }
  foreach ($this->compiler
    ->getPassConfig()
    ->getPasses() as $pass) {
    $this
      ->addObjectResource($pass);
  }
  $this->compiler
    ->compile($this);
  $this->extensionConfigs = array();
  parent::compile();
}