[FrameworkBundle] Empty event dispatcher earlier in CacheClearCommand

This commit is contained in:
Nicolas Grekas 2017-11-15 00:32:17 +02:00
parent ecad1c4b3b
commit a96139273f

View File

@ -111,6 +111,9 @@ EOF
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $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');
}