Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a85889e

Browse files
[FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCacheWarmer
1 parent 8980568 commit a85889e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
1616
use Symfony\Component\Config\Builder\ConfigBuilderGeneratorInterface;
1717
use Symfony\Component\Config\Definition\ConfigurationInterface;
18+
use Symfony\Component\DependencyInjection\Container;
1819
use Symfony\Component\DependencyInjection\ContainerBuilder;
1920
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
2021
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
22+
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBag;
23+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
2124
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
2225
use Symfony\Component\HttpKernel\KernelInterface;
2326

@@ -71,7 +74,8 @@ private function dumpExtension(ExtensionInterface $extension, ConfigBuilderGener
7174
if ($extension instanceof ConfigurationInterface) {
7275
$configuration = $extension;
7376
} elseif ($extension instanceof ConfigurationExtensionInterface) {
74-
$configuration = $extension->getConfiguration([], new ContainerBuilder($this->kernel->getContainer()->getParameterBag()));
77+
$container = $this->kernel->getContainer();
78+
$configuration = $extension->getConfiguration([], new ContainerBuilder($container instanceof Container ? new ContainerBag($container) : new ParameterBag()));
7579
}
7680

7781
if (!$configuration) {

0 commit comments

Comments
 (0)