8000 grab a service from the container only if it exists · symfony/symfony@26bae82 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26bae82

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7070
$clearers = [];
7171

7272
$poolNames = $input->getArgument('pools');
73+
$clearAll = false;
7374
if ($input->getOption('all')) {
75+
$clearAll = true;
7476
if (!$this->poolNames) {
7577
throw new InvalidArgumentException('Could not clear all cache pools, try specifying a specific pool or cache clearer.');
7678
}
@@ -84,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8486
foreach ($poolNames as $id) {
8587
if ($this->poolClearer->hasPool($id)) {
8688
$pools[$id] = $id;
87-
} else {
89+
} elseif (!$clearAll || $kernel->getContainer()->has($id)) {
8890
$pool = $kernel->getContainer()->get($id);
8991

9092
if ($pool instanceof CacheItemPoolInterface) {

0 commit comments

Comments
 (0)
0