PHP Class Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition

Author: Johannes M. Schmitt ([email protected])
Inheritance: extends Symfony\Component\Config\Definition\Builder\NodeDefinition, implements Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface
Mostra file Open project: symfony/symfony Class Usage Examples

Protected Properties

Property Type Description
$addDefaultChildren
$addDefaults
$allowNewKeys
$atLeastOne
$children
$ignoreExtraKeys
$key
$nodeBuilder
$normalizeKeys
$performDeepMerging
$prototype
$removeExtraKeys
$removeKeyItem

Public Methods

Method Description
__construct ( $name, NodeParentInterface $parent = null )
addDefaultChildrenIfNoneSet ( integer | string | array | null $children = null ) : ArrayNodeDefinition Adds children with a default value when none are defined.
addDefaultsIfNotSet ( ) : ArrayNodeDefinition Adds the default value if the node is not set in the configuration.
append ( Symfony\Component\Config\Definition\Builder\NodeDefinition $node ) : ArrayNodeDefinition Appends a node definition.
arrayPrototype ( ) : ArrayNodeDefinition
booleanPrototype ( ) : Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition
canBeDisabled ( ) : ArrayNodeDefinition Adds an "enabled" boolean to enable the current section.
canBeEnabled ( ) : ArrayNodeDefinition Adds an "enabled" boolean to enable the current section.
canBeUnset ( boolean $allow = true ) : ArrayNodeDefinition Sets whether the node can be unset.
children ( ) : Symfony\Component\Config\Definition\Builder\NodeBuilder Returns a builder to add children nodes.
disallowNewKeysInSubsequentConfigs ( ) : ArrayNodeDefinition Disallows adding news keys in a subsequent configuration.
enumPrototype ( ) : Symfony\Component\Config\Definition\Builder\EnumNodeDefinition
fixXmlConfig ( string $singular, string $plural = null ) : ArrayNodeDefinition Sets a normalization rule for XML configurations.
floatPrototype ( ) : Symfony\Component\Config\Definition\Builder\FloatNodeDefinition
ignoreExtraKeys ( boolean $remove = true ) : ArrayNodeDefinition Allows extra config keys to be specified under an array without throwing an exception.
integerPrototype ( ) : Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition
normalizeKeys ( boolean $bool ) : ArrayNodeDefinition Sets key normalization.
performNoDeepMerging ( ) : ArrayNodeDefinition Disables the deep merging of the node.
prototype ( string $type ) : Symfony\Component\Config\Definition\Builder\NodeDefinition Sets a prototype for child nodes.
requiresAtLeastOneElement ( ) : ArrayNodeDefinition Requires the node to have at least one element.
scalarPrototype ( ) : Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition
setBuilder ( Symfony\Component\Config\Definition\Builder\NodeBuilder $builder ) Sets a custom children builder.
useAttributeAsKey ( string $name, boolean $removeKeyItem = true ) : ArrayNodeDefinition Sets the attribute which value is to be used as key.
variablePrototype ( ) : Symfony\Component\Config\Definition\Builder\VariableNodeDefinition

Protected Methods

Method Description
createNode ( )
getNodeBuilder ( ) : Symfony\Component\Config\Definition\Builder\NodeBuilder Returns a node builder to be used to add children and prototype.
validateConcreteNode ( Symfony\Component\Config\Definition\ArrayNode $node ) Validate the configuration of a concrete node.
validatePrototypeNode ( PrototypedArrayNode $node ) Validate the configuration of a prototype node.

Method Details

__construct() public method

public __construct ( $name, NodeParentInterface $parent = null )
$parent NodeParentInterface

addDefaultChildrenIfNoneSet() public method

Adds children with a default value when none are defined.
public addDefaultChildrenIfNoneSet ( integer | string | array | null $children = null ) : ArrayNodeDefinition
$children integer | string | array | null The number of children|The child name|The children names to be added This method is applicable to prototype nodes only.
return ArrayNodeDefinition

addDefaultsIfNotSet() public method

This method is applicable to concrete nodes only (not to prototype nodes). If this function has been called and the node is not set during the finalization phase, it's default value will be derived from its children default values.
public addDefaultsIfNotSet ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

append() public method

$node = new ArrayNodeDefinition() ->children() ->scalarNode('foo')->end() ->scalarNode('baz')->end() ->end() ->append($this->getBarNodeDefinition()) ;
public append ( Symfony\Component\Config\Definition\Builder\NodeDefinition $node ) : ArrayNodeDefinition
$node Symfony\Component\Config\Definition\Builder\NodeDefinition A NodeDefinition instance
return ArrayNodeDefinition This node

arrayPrototype() public method

public arrayPrototype ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

booleanPrototype() public method

public booleanPrototype ( ) : Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition
return Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition

canBeDisabled() public method

By default, the section is enabled.
public canBeDisabled ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

canBeEnabled() public method

By default, the section is disabled. If any configuration is specified then the node will be automatically enabled: enableableArrayNode: {enabled: true, ...} # The config is enabled & default values get overridden enableableArrayNode: ~ # The config is enabled & use the default values enableableArrayNode: true # The config is enabled & use the default values enableableArrayNode: {other: value, ...} # The config is enabled & default values get overridden enableableArrayNode: {enabled: false, ...} # The config is disabled enableableArrayNode: false # The config is disabled
public canBeEnabled ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

canBeUnset() public method

Sets whether the node can be unset.
public canBeUnset ( boolean $allow = true ) : ArrayNodeDefinition
$allow boolean
return ArrayNodeDefinition

children() public method

Returns a builder to add children nodes.
public children ( ) : Symfony\Component\Config\Definition\Builder\NodeBuilder
return Symfony\Component\Config\Definition\Builder\NodeBuilder

createNode() protected method

protected createNode ( )

disallowNewKeysInSubsequentConfigs() public method

If used all keys have to be defined in the same configuration file.
public disallowNewKeysInSubsequentConfigs ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

enumPrototype() public method

public enumPrototype ( ) : Symfony\Component\Config\Definition\Builder\EnumNodeDefinition
return Symfony\Component\Config\Definition\Builder\EnumNodeDefinition

fixXmlConfig() public method

Sets a normalization rule for XML configurations.
public fixXmlConfig ( string $singular, string $plural = null ) : ArrayNodeDefinition
$singular string The key to remap
$plural string The plural of the key for irregular plurals
return ArrayNodeDefinition

floatPrototype() public method

public floatPrototype ( ) : Symfony\Component\Config\Definition\Builder\FloatNodeDefinition
return Symfony\Component\Config\Definition\Builder\FloatNodeDefinition

getNodeBuilder() protected method

Returns a node builder to be used to add children and prototype.
protected getNodeBuilder ( ) : Symfony\Component\Config\Definition\Builder\NodeBuilder
return Symfony\Component\Config\Definition\Builder\NodeBuilder The node builder

ignoreExtraKeys() public method

Those config values are simply ignored and removed from the resulting array. This should be used only in special cases where you want to send an entire configuration array through a special tree that processes only part of the array.
public ignoreExtraKeys ( boolean $remove = true ) : ArrayNodeDefinition
$remove boolean Whether to remove the extra keys
return ArrayNodeDefinition

integerPrototype() public method

public integerPrototype ( ) : Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition
return Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition

normalizeKeys() public method

Sets key normalization.
public normalizeKeys ( boolean $bool ) : ArrayNodeDefinition
$bool boolean Whether to enable key normalization
return ArrayNodeDefinition

performNoDeepMerging() public method

Disables the deep merging of the node.
public performNoDeepMerging ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

prototype() public method

Sets a prototype for child nodes.
public prototype ( string $type ) : Symfony\Component\Config\Definition\Builder\NodeDefinition
$type string the type of node
return Symfony\Component\Config\Definition\Builder\NodeDefinition

requiresAtLeastOneElement() public method

This method is applicable to prototype nodes only.
public requiresAtLeastOneElement ( ) : ArrayNodeDefinition
return ArrayNodeDefinition

scalarPrototype() public method

public scalarPrototype ( ) : Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition
return Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition

setBuilder() public method

Sets a custom children builder.
public setBuilder ( Symfony\Component\Config\Definition\Builder\NodeBuilder $builder )
$builder Symfony\Component\Config\Definition\Builder\NodeBuilder A custom NodeBuilder

useAttributeAsKey() public method

This is useful when you have an indexed array that should be an associative array. You can select an item from within the array to be the key of the particular item. For example, if "id" is the "key", then: array( array('id' => 'my_name', 'foo' => 'bar'), ); becomes array( 'my_name' => array('foo' => 'bar'), ); If you'd like "'id' => 'my_name'" to still be present in the resulting array, then you can set the second argument of this method to false. This method is applicable to prototype nodes only.
public useAttributeAsKey ( string $name, boolean $removeKeyItem = true ) : ArrayNodeDefinition
$name string The name of the key
$removeKeyItem boolean Whether or not the key item should be removed
return ArrayNodeDefinition

validateConcreteNode() protected method

Validate the configuration of a concrete node.
protected validateConcreteNode ( Symfony\Component\Config\Definition\ArrayNode $node )
$node Symfony\Component\Config\Definition\ArrayNode The related node

validatePrototypeNode() protected method

Validate the configuration of a prototype node.
protected validatePrototypeNode ( PrototypedArrayNode $node )
$node Symfony\Component\Config\Definition\PrototypedArrayNode The related node

variablePrototype() public method

public variablePrototype ( ) : Symfony\Component\Config\Definition\Builder\VariableNodeDefinition
return Symfony\Component\Config\Definition\Builder\VariableNodeDefinition

Property Details

$addDefaultChildren protected_oe property

protected $addDefaultChildren

$addDefaults protected_oe property

protected $addDefaults

$allowNewKeys protected_oe property

protected $allowNewKeys

$atLeastOne protected_oe property

protected $atLeastOne

$children protected_oe property

protected $children

$ignoreExtraKeys protected_oe property

protected $ignoreExtraKeys

$key protected_oe property

protected $key

$nodeBuilder protected_oe property

protected $nodeBuilder

$normalizeKeys protected_oe property

protected $normalizeKeys

$performDeepMerging protected_oe property

protected $performDeepMerging

$prototype protected_oe property

protected $prototype

$removeExtraKeys protected_oe property

protected $removeExtraKeys

$removeKeyItem protected_oe property

protected $removeKeyItem