Beispiel #1
0
 /**
  * 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 \Symfony\Component\Config\ConfigCache($this->getContainerFile(true), $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'));
     }
 }
Beispiel #2
0
 /**
  * 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 \Symfony\Component\Config\ConfigCache($this->getContainerFile(true), $this->debug);
     $fresh = file_exists($this->getCacheDir() . '/classes.php');
     if (!$cache->isFresh()) {
         $container = $this->buildContainer();
         $container->compile();
         $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
         if ($this->debug) {
             $fresh = false;
         }
     }
     require_once $cache->getPath();
     $this->container = new $class();
     $this->container->set('kernel', $this);
     // Warm up the cache if classes.php is missing or in dev mode
     if (!$fresh && $this->container->has('cache_warmer')) {
         $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
     }
 }