protected function Kernel::initializeContainer

Initializes the service container.

The cached version of the service container is used when fresh, otherwise the container is built.

1 call to Kernel::initializeContainer()
Kernel::boot in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php
Boots the current kernel.
1 method overrides Kernel::initializeContainer()
DrupalKernel::initializeContainer in drupal/core/lib/Drupal/Core/DrupalKernel.php
Initializes the service container.

File

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

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function initializeContainer() {
  $class = $this
    ->getContainerClass();
  $cache = new ConfigCache($this
    ->getCacheDir() . '/' . $class . '.php', $this->debug);
  $fresh = true;
  if (!$cache
    ->isFresh()) {
    $container = $this
      ->buildContainer();
    $container
      ->compile();
    $this
      ->dumpContainer($cache, $container, $class, $this
      ->getContainerBaseClass());
    $fresh = false;
  }
  require_once $cache;
  $this->container = new $class();
  $this->container
    ->set('kernel', $this);
  if (!$fresh && $this->container
    ->has('cache_warmer')) {
    $this->container
      ->get('cache_warmer')
      ->warmUp($this->container
      ->getParameter('kernel.cache_dir'));
  }
}