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
Afficher le fichier Open project: symfony/symfony Class Usage Examples

Protected Properties

Свойство Type Description
$addDefaultChildren
$addDefaults
$allowNewKeys
$atLeastOne
$children
$ignoreExtraKeys
$key
$nodeBuilder
$normalizeKeys
$performDeepMerging
$prototype
$removeExtraKeys
$removeKeyItem

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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

addDefaultChildrenIfNoneSet() public méthode

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.
Résultat ArrayNodeDefinition

addDefaultsIfNotSet() public méthode

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
Résultat ArrayNodeDefinition

append() public méthode

$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
Résultat ArrayNodeDefinition This node

arrayPrototype() public méthode

public arrayPrototype ( ) : ArrayNodeDefinition
Résultat ArrayNodeDefinition

booleanPrototype() public méthode

public booleanPrototype ( ) : Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition
Résultat Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition

canBeDisabled() public méthode

By default, the section is enabled.
public canBeDisabled ( ) : ArrayNodeDefinition
Résultat ArrayNodeDefinition

canBeEnabled() public méthode

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
Résultat ArrayNodeDefinition

canBeUnset() public méthode

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

children() public méthode

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

createNode() protected méthode

protected createNode ( )

disallowNewKeysInSubsequentConfigs() public méthode

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

enumPrototype() public méthode

public enumPrototype ( ) : Symfony\Component\Config\Definition\Builder\EnumNodeDefinition
Résultat Symfony\Component\Config\Definition\Builder\EnumNodeDefinition

fixXmlConfig() public méthode

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
Résultat ArrayNodeDefinition

floatPrototype() public méthode

public floatPrototype ( ) : Symfony\Component\Config\Definition\Builder\FloatNodeDefinition
Résultat Symfony\Component\Config\Definition\Builder\FloatNodeDefinition

getNodeBuilder() protected méthode

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

ignoreExtraKeys() public méthode

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
Résultat ArrayNodeDefinition

integerPrototype() public méthode

public integerPrototype ( ) : Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition
Résultat Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition

normalizeKeys() public méthode

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

performNoDeepMerging() public méthode

Disables the deep merging of the node.
public performNoDeepMerging ( ) : ArrayNodeDefinition
Résultat ArrayNodeDefinition

prototype() public méthode

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

requiresAtLeastOneElement() public méthode

This method is applicable to prototype nodes only.
public requiresAtLeastOneElement ( ) : ArrayNodeDefinition
Résultat ArrayNodeDefinition

scalarPrototype() public méthode

public scalarPrototype ( ) : Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition
Résultat Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition

setBuilder() public méthode

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 méthode

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
Résultat ArrayNodeDefinition

validateConcreteNode() protected méthode

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 méthode

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

variablePrototype() public méthode

public variablePrototype ( ) : Symfony\Component\Config\Definition\Builder\VariableNodeDefinition
Résultat 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