Skip to content

Commit fe670dc

Browse files
committed
grab a service from the container only if it exists
1 parent 5f069d2 commit fe670dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7070
$clearers = [];
7171

7272
$poolNames = $input->getArgument('pools');
73-
if ($input->getOption('all')) {
73+
if ($clearAll = $input->getOption('all')) {
7474
if (!$this->poolNames) {
7575
throw new InvalidArgumentException('Could not clear all cache pools, try specifying a specific pool or cache clearer.');
7676
}
@@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8484
foreach ($poolNames as $id) {
8585
if ($this->poolClearer->hasPool($id)) {
8686
$pools[$id] = $id;
87-
} else {
87+
} elseif (!$clearAll || $kernel->getContainer()->has($id)) {
8888
$pool = $kernel->getContainer()->get($id);
8989

9090
if ($pool instanceof CacheItemPoolInterface) {

0 commit comments

Comments
 (0)