Navigation Menu

Skip to content

Commit

Permalink
bug #34784 [FrameworkBundle] Set the parameter bag as resolved in Con…
Browse files Browse the repository at this point in the history
…tainerLintCommand (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Set the parameter bag as resolved in ContainerLintCommand

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34526, Closes #34767
| License       | MIT
| Doc PR        | -

Alternative to #34767, idea by @nicolas-grekas.

Commits
-------

e8d3c2b [FrameworkBundle] Set the parameter bag as resolved in ContainerLintCommand
  • Loading branch information
Robin Chalas committed Dec 3, 2019
2 parents 1f00705 + e8d3c2b commit c01a583
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;

final class ContainerLintCommand extends Command
{
Expand Down Expand Up @@ -71,7 +72,11 @@ private function getContainerBuilder(): ContainerBuilder
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
$container = $buildContainer();
} else {
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
(new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));

$refl = new \ReflectionProperty($parameterBag, 'resolved');
$refl->setAccessible(true);
$refl->setValue($parameterBag, true);
}

return $this->containerBuilder = $container;
Expand Down

0 comments on commit c01a583

Please sign in to comment.