Initializes the service container.
The cached version of the service container is used when fresh, otherwise the container is built.
protected function initializeContainer() {
$class = $this
->getContainerClass();
$cache = new ConfigCache($this
->getCacheDir() . '/' . $class . '.php', $this->debug);
$fresh = true;
if (!$cache
->isFresh()) {
$container = $this
->buildContainer();
$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'));
}
}