mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -26,7 +26,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
||||
*/
|
||||
trait BuildDebugContainerTrait
|
||||
{
|
||||
protected $containerBuilder;
|
||||
protected ContainerBuilder $container;
|
||||
|
||||
/**
|
||||
* Loads the ContainerBuilder from the cache.
|
||||
@@ -35,22 +35,29 @@ trait BuildDebugContainerTrait
|
||||
*/
|
||||
protected function getContainerBuilder(KernelInterface $kernel): ContainerBuilder
|
||||
{
|
||||
if ($this->containerBuilder) {
|
||||
return $this->containerBuilder;
|
||||
if (isset($this->container)) {
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
|
||||
if (!$kernel->isDebug() || !$kernel->getContainer()->getParameter('debug.container.dump') || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
|
||||
$buildContainer = \Closure::bind(function () {
|
||||
$this->initializeBundles();
|
||||
|
||||
return $this->buildContainer();
|
||||
}, $kernel, \get_class($kernel));
|
||||
}, $kernel, $kernel::class);
|
||||
$container = $buildContainer();
|
||||
$container->getCompilerPassConfig()->setRemovingPasses([]);
|
||||
$container->getCompilerPassConfig()->setAfterRemovingPasses([]);
|
||||
$container->compile();
|
||||
} else {
|
||||
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
|
||||
$buildContainer = \Closure::bind(function () {
|
||||
$containerBuilder = $this->getContainerBuilder();
|
||||
$this->prepareContainer($containerBuilder);
|
||||
|
||||
return $containerBuilder;
|
||||
}, $kernel, $kernel::class);
|
||||
$container = $buildContainer();
|
||||
(new XmlFileLoader($container, new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
|
||||
$locatorPass = new ServiceLocatorTagPass();
|
||||
$locatorPass->process($container);
|
||||
|
||||
@@ -59,6 +66,6 @@ trait BuildDebugContainerTrait
|
||||
$container->getCompilerPassConfig()->setBeforeRemovingPasses([]);
|
||||
}
|
||||
|
||||
return $this->containerBuilder = $container;
|
||||
return $this->container = $container;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user