Skip to content

Commit

Permalink
fixes a bug where getParameterBag() always returns null
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoh committed Jul 16, 2011
1 parent 827bfb9 commit d0b056c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Expand Up @@ -601,7 +601,7 @@ private function addServices()
*/
private function startClass($class, $baseClass)
{
$bagClass = $this->container->isFrozen() ? '' : 'use Symfony\Component\DependencyInjection\ParameterBag\\ParameterBag;';
$bagClass = $this->container->isFrozen() ? 'use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;' : 'use Symfony\Component\DependencyInjection\ParameterBag\\ParameterBag;';

return <<<EOF
<?php
Expand Down Expand Up @@ -743,6 +743,18 @@ public function setParameter(\$name, \$value)
{
throw new \LogicException('Impossible to call set() on a frozen ParameterBag.');
}
/**
* {@inheritDoc}
*/
public function getParameterBag()
{
if (null === \$this->parameterBag) {
\$this->parameterBag = new FrozenParameterBag(\$this->parameters);
}
return \$this->parameterBag;
}
EOF;
}

Expand Down

0 comments on commit d0b056c

Please sign in to comment.