[DependencyInjection] Added exception to avoid fatal during compile in a frozen dumped container
This commit is contained in:
parent
eb1e3c344c
commit
2356eaad5f
@ -109,6 +109,7 @@ class PhpDumper extends Dumper
|
||||
|
||||
if ($this->container->isFrozen()) {
|
||||
$code .= $this->addFrozenConstructor();
|
||||
$code .= $this->addFrozenCompile();
|
||||
} else {
|
||||
$code .= $this->addConstructor();
|
||||
}
|
||||
@ -851,6 +852,26 @@ EOF;
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the constructor for a frozen container.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function addFrozenCompile()
|
||||
{
|
||||
return <<<EOF
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile()
|
||||
{
|
||||
throw new LogicException("You cannot compile a dumped frozen container");
|
||||
}
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the methodMap property definition
|
||||
*
|
||||
|
@ -40,6 +40,14 @@ class ProjectServiceContainer extends Container
|
||||
$this->aliases = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile()
|
||||
{
|
||||
throw new LogicException("You cannot compile a dumped frozen container");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the 'test' service.
|
||||
*
|
||||
|
@ -38,6 +38,14 @@ class ProjectServiceContainer extends Container
|
||||
$this->aliases = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile()
|
||||
{
|
||||
throw new LogicException("You cannot compile a dumped frozen container");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the 'foo' service.
|
||||
*
|
||||
|
@ -55,6 +55,14 @@ class ProjectServiceContainer extends Container
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile()
|
||||
{
|
||||
throw new LogicException("You cannot compile a dumped frozen container");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the 'bar' service.
|
||||
*
|
||||
|
Reference in New Issue
Block a user