protected function Kernel::prepareContainer

Prepares the ContainerBuilder before it is compiled.

Parameters

ContainerBuilder $container A ContainerBuilder instance:

1 call to Kernel::prepareContainer()
Kernel::buildContainer in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php
Builds the service container.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php, line 661

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function prepareContainer(ContainerBuilder $container) {
  $extensions = array();
  foreach ($this->bundles as $bundle) {
    if ($extension = $bundle
      ->getContainerExtension()) {
      $container
        ->registerExtension($extension);
      $extensions[] = $extension
        ->getAlias();
    }
    if ($this->debug) {
      $container
        ->addObjectResource($bundle);
    }
  }
  foreach ($this->bundles as $bundle) {
    $bundle
      ->build($container);
  }

  // ensure these extensions are implicitly loaded
  $container
    ->getCompilerPassConfig()
    ->setMergePass(new MergeExtensionConfigurationPass($extensions));
}