[Config] Fix nested prototyped array nodes
This commit is contained in:
parent
675e5eb6e0
commit
bc122bdb2d
|
@ -307,7 +307,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||
|
||||
if (false !== $this->addDefaultChildren) {
|
||||
$node->setAddChildrenIfNoneSet($this->addDefaultChildren);
|
||||
if ($this->prototype instanceof static) {
|
||||
if ($this->prototype instanceof static && null === $this->prototype->prototype) {
|
||||
$this->prototype->addDefaultsIfNotSet();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,17 @@ class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(array(array()), $tree->getDefaultValue());
|
||||
}
|
||||
|
||||
public function testNestedPrototypedArrayNodes()
|
||||
{
|
||||
$node = new ArrayNodeDefinition('root');
|
||||
$node
|
||||
->addDefaultChildrenWhenNoneSet()
|
||||
->prototype('array')
|
||||
->prototype('array')
|
||||
;
|
||||
$tree = $node->getNode();
|
||||
}
|
||||
|
||||
protected function getField($object, $field)
|
||||
{
|
||||
$reflection = new \ReflectionProperty($object, $field);
|
||||
|
|
Reference in New Issue