[Config] Introduce BuilderAwareInterface
This commit is contained in:
parent
d203ee3395
commit
1353694bfd
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\Config\Definition\Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface that can be implemented by nodes which build other nodes.
|
||||||
|
*
|
||||||
|
* @author Roland Franssen <franssen.roland@gmail.com>
|
||||||
|
*/
|
||||||
|
interface BuilderAwareInterface
|
||||||
|
{
|
||||||
|
public function setBuilder(NodeBuilder $builder);
|
||||||
|
}
|
@ -186,7 +186,7 @@ class NodeBuilder implements NodeParentInterface
|
|||||||
*/
|
*/
|
||||||
public function append(NodeDefinition $node)
|
public function append(NodeDefinition $node)
|
||||||
{
|
{
|
||||||
if ($node instanceof ParentNodeDefinitionInterface) {
|
if ($node instanceof BuilderAwareInterface) {
|
||||||
$builder = clone $this;
|
$builder = clone $this;
|
||||||
$builder->setParent(null);
|
$builder->setParent(null);
|
||||||
$node->setBuilder($builder);
|
$node->setBuilder($builder);
|
||||||
|
@ -16,11 +16,9 @@ namespace Symfony\Component\Config\Definition\Builder;
|
|||||||
*
|
*
|
||||||
* @author Victor Berchet <victor@suumit.com>
|
* @author Victor Berchet <victor@suumit.com>
|
||||||
*/
|
*/
|
||||||
interface ParentNodeDefinitionInterface
|
interface ParentNodeDefinitionInterface extends BuilderAwareInterface
|
||||||
{
|
{
|
||||||
public function children();
|
public function children();
|
||||||
|
|
||||||
public function append(NodeDefinition $node);
|
public function append(NodeDefinition $node);
|
||||||
|
|
||||||
public function setBuilder(NodeBuilder $builder);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user