Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Kernel.php

function Kernel::prepareContainer

Prepares the ContainerBuilder before it is compiled.

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

File

vendor/symfony/http-kernel/Kernel.php, line 618

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function prepareContainer(ContainerBuilder $container) : void {
    $extensions = [];
    foreach ($this->bundles as $bundle) {
        if ($extension = $bundle->getContainerExtension()) {
            $container->registerExtension($extension);
        }
        if ($this->debug) {
            $container->addObjectResource($bundle);
        }
    }
    foreach ($this->bundles as $bundle) {
        $bundle->build($container);
    }
    $this->build($container);
    foreach ($container->getExtensions() as $extension) {
        $extensions[] = $extension->getAlias();
    }
    // ensure these extensions are implicitly loaded
    $container->getCompilerPassConfig()
        ->setMergePass(new MergeExtensionConfigurationPass($extensions));
}
RSS feed
Powered by Drupal