You are here

protected function Kernel::initializeContainer in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Kernel.php \Symfony\Component\HttpKernel\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 vendor/symfony/http-kernel/Kernel.php
Boots the current kernel.

File

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

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
    ->getPath();
  $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'));
  }
}