Closed
Description
When configuring the container using the DefinitionDecorator
as described in this guide the expected outcome is... unexpected.
The following example illustrates the problem. $test->foo
should have the value foo
instead of null
.
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
abstract class TestAbstract
{
public $foo;
public function __construct($foo = null)
{
$this->foo = $foo;
}
}
class Test extends TestAbstract
{
}
$container = new ContainerBuilder();
$container->register('test_abstract')
->addArgument('foo')
->setAbstract(true);
$container->setDefinition('test', new DefinitionDecorator('test_abstract'))
->setClass('Test');
$test = $container->get('test');
var_dump($test->foo); // is null...
Looks like there aren't any tests for this functionality.