diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 4080d2a3d2..861bf21962 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -111,6 +111,9 @@ EOF $io->comment(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); $this->cacheClearer->clear($realCacheDir); + // The current event dispatcher is stale, let's not use it anymore + $this->getApplication()->setDispatcher(new EventDispatcher()); + if ($input->getOption('no-warmup')) { $this->filesystem->rename($realCacheDir, $oldCacheDir); } else { @@ -129,9 +132,6 @@ EOF $this->filesystem->remove($oldCacheDir); - // The current event dispatcher is stale, let's not use it anymore - $this->getApplication()->setDispatcher(new EventDispatcher()); - if ($output->isVerbose()) { $io->comment('Finished'); }