Skip to content

Commit b4b95d4

Browse files
[FrameworkBundle] Fix calling Kernel::warmUp() when running cache:warmup
1 parent 63e4ad1 commit b4b95d4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Command/CacheWarmupCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Console\Style\SymfonyStyle;
1919
use Symfony\Component\DependencyInjection\Dumper\Preloader;
2020
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
21+
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
2122

2223
/**
2324
* Warmup the cache.
@@ -73,8 +74,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7374
if (!$input->getOption('no-optional-warmers')) {
7475
$this->cacheWarmer->enableOptionalWarmers();
7576
}
77+
$cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
7678

77-
$preload = $this->cacheWarmer->warmUp($cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'));
79+
if ($kernel instanceof WarmableInterface) {
80+
$kernel->warmUp($cacheDir);
81+
}
82+
83+
$preload = $this->cacheWarmer->warmUp($cacheDir);
7884

7985
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
8086
Preloader::append($preloadFile, $preload);

0 commit comments

Comments
 (0)