From 74e297a94a915b77e07b9f3771377a88f55497d9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 31 May 2021 10:53:28 +0200 Subject: [PATCH] [FrameworkBundle] fix creating ContainerBuilder at warmup/CLI time --- .../FrameworkBundle/Command/BuildDebugContainerTrait.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php b/src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php index 7f2e0c871b02e..440c4762a95e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php @@ -40,7 +40,11 @@ protected function getContainerBuilder(KernelInterface $kernel): ContainerBuilde } 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 () { + $this->initializeBundles(); + + return $this->buildContainer(); + }, $kernel, \get_class($kernel)); $container = $buildContainer(); $container->getCompilerPassConfig()->setRemovingPasses([]); $container->getCompilerPassConfig()->setAfterRemovingPasses([]);