[FrameworkBundle][ContainerLintCommand] Reinitialize bundles when the container is reprepared

This commit is contained in:
Thomas Calvet 2019-12-06 19:56:25 +01:00
parent 70dec3c8a3
commit 31975e4981

View File

@ -69,7 +69,11 @@ final class ContainerLintCommand extends Command
$kernel = $this->getApplication()->getKernel();
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
$buildContainer = \Closure::bind(function (): ContainerBuilder {
$this->initializeBundles();
return $this->buildContainer();
}, $kernel, \get_class($kernel));
$container = $buildContainer();
} else {
(new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));