From 3daedc9ff39d38a3087961fd2c420d96720e21d7 Mon Sep 17 00:00:00 2001 From: Anthon Pang Date: Wed, 3 Jul 2013 17:17:16 -0400 Subject: [PATCH] Alternate fix for #96; tested with symfony-standard v2.2.3 (and v2.3.1 with JMSDiExtraBundle and JMSSecurityExtraBundle dependencies restored) --- HttpKernel/ControllerInjectorsWarmer.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/HttpKernel/ControllerInjectorsWarmer.php b/HttpKernel/ControllerInjectorsWarmer.php index 05e8b3f..3390c75 100755 --- a/HttpKernel/ControllerInjectorsWarmer.php +++ b/HttpKernel/ControllerInjectorsWarmer.php @@ -9,12 +9,14 @@ class ControllerInjectorsWarmer implements CacheWarmerInterface { + static protected $warm; private $kernel; private $controllerResolver; private $blackListedControllerFiles; public function __construct(KernelInterface $kernel, ControllerResolver $resolver, array $blackListedControllerFiles) { + static::$warm = false; $this->kernel = $kernel; $this->controllerResolver = $resolver; $this->blackListedControllerFiles = $blackListedControllerFiles; @@ -22,6 +24,12 @@ public function __construct(KernelInterface $kernel, ControllerResolver $resolve public function warmUp($cacheDir) { + if (static::$warm === true) { + return; + } + + static::$warm = true; + // This avoids class-being-declared twice errors when the cache:clear // command is called. The controllers are not pre-generated in that case. $suffix = defined('Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate::NEW_CACHE_FOLDER_SUFFIX')