10000 bug #53572 [FrameworkBundle] grab a service from the container only i… · symfony/symfony@8d8c8fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d8c8fe

Browse files
bug #53572 [FrameworkBundle] grab a service from the container only if it exists (xabbuh)
This PR was merged into the 6.3 branch. Discussion ---------- [FrameworkBundle] grab a service from the container only if it exists | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53551 | License | MIT Commits ------- fe670dc grab a service from the container only if it exists
2 parents 5f069d2 + fe670dc commit 8d8c8fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
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)
0