class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface
This class provides a fluent interface for defining an array node.
Methods
|
__construct(string $name, NodeParentInterface $parent = null)
Constructor |
||
| setBuilder(NodeBuilder $builder) | ||
| NodeBuilder | children() | |
| NodeDefinition |
prototype(string $type)
Sets a prototype for child nodes. |
|
| ArrayNodeDefinition |
addDefaultsIfNotSet()
Adds the default value if the node is not set in the configuration. |
|
| ArrayNodeDefinition |
addDefaultChildrenIfNoneSet(integer|string|array|null $children = null)
Adds children with a default value when none are defined. |
|
| ArrayNodeDefinition |
requiresAtLeastOneElement()
Requires the node to have at least one element. |
|
| ArrayNodeDefinition |
disallowNewKeysInSubsequentConfigs()
Disallows adding news keys in a subsequent configuration. |
|
| ArrayNodeDefinition |
fixXmlConfig(string $singular, string $plural = null)
Sets a normalization rule for XML configurations. |
|
| ArrayNodeDefinition |
useAttributeAsKey(string $name, Boolean $removeKeyItem = true)
Sets the attribute which value is to be used as key. |
|
| ArrayNodeDefinition |
canBeUnset(Boolean $allow = true)
Sets whether the node can be unset. |
|
| ArrayNodeDefinition |
canBeEnabled()
Adds an "enabled" boolean to enable the current section. |
|
| ArrayNodeDefinition |
canBeDisabled()
Adds an "enabled" boolean to enable the current section. |
|
| ArrayNodeDefinition |
performNoDeepMerging()
Disables the deep merging of the node. |
|
| ArrayNodeDefinition |
ignoreExtraKeys()
Allows extra config keys to be specified under an array without throwing an exception. |
|
| ArrayNodeDefinition |
normalizeKeys(Boolean $bool)
Sets key normalization. |
|
| ArrayNodeDefinition | append(NodeDefinition $node) |
Details
at line 41
public
__construct(string $name, NodeParentInterface $parent = null)
Constructor
at line 62
public
setBuilder(NodeBuilder $builder)
at line 72
public NodeBuilder
children()
at line 84
public NodeDefinition
prototype(string $type)
Sets a prototype for child nodes.
at line 98
public ArrayNodeDefinition
addDefaultsIfNotSet()
Adds the default value if the node is not set in the configuration.
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.
at line 114
public ArrayNodeDefinition
addDefaultChildrenIfNoneSet(integer|string|array|null $children = null)
Adds children with a default value when none are defined.
at line 128
public ArrayNodeDefinition
requiresAtLeastOneElement()
Requires the node to have at least one element.
This method is applicable to prototype nodes only.
at line 142
public ArrayNodeDefinition
disallowNewKeysInSubsequentConfigs()
Disallows adding news keys in a subsequent configuration.
If used all keys have to be defined in the same configuration file.
at line 157
public ArrayNodeDefinition
fixXmlConfig(string $singular, string $plural = null)
Sets a normalization rule for XML configurations.
at line 192
public ArrayNodeDefinition
useAttributeAsKey(string $name, Boolean $removeKeyItem = true)
Sets the attribute which value is to be used as key.
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.
at line 207
public ArrayNodeDefinition
canBeUnset(Boolean $allow = true)
Sets whether the node can be unset.
at line 229
public ArrayNodeDefinition
canBeEnabled()
Adds an "enabled" boolean to enable the current section.
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
at line 259
public ArrayNodeDefinition
canBeDisabled()
Adds an "enabled" boolean to enable the current section.
By default, the section is enabled.
at line 279
public ArrayNodeDefinition
performNoDeepMerging()
Disables the deep merging of the node.
at line 296
public ArrayNodeDefinition
ignoreExtraKeys()
Allows extra config keys to be specified under an array without throwing an exception.
Those config values are simply ignored. 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.
at line 310
public ArrayNodeDefinition
normalizeKeys(Boolean $bool)
Sets key normalization.