| Methods |
public
|
__construct(?string $name, NodeParentInterface $parent = null)
|
#
|
public
|
setBuilder(NodeBuilder $builder): void
Sets a custom children builder.
Sets a custom children builder.
Implements
|
#
|
public
|
children(): NodeBuilder
Returns a builder to add children nodes.
Returns a builder to add children nodes.
Implements
|
#
|
public
|
prototype(string $type): NodeDefinition
Sets a prototype for child nodes.
Sets a prototype for child nodes.
|
#
|
public
|
variablePrototype(): VariableNodeDefinition
|
#
|
public
|
scalarPrototype(): ScalarNodeDefinition
|
#
|
public
|
booleanPrototype(): BooleanNodeDefinition
|
#
|
public
|
integerPrototype(): IntegerNodeDefinition
|
#
|
public
|
floatPrototype(): FloatNodeDefinition
|
#
|
public
|
arrayPrototype(): self
|
#
|
public
|
enumPrototype(): EnumNodeDefinition
|
#
|
public
|
addDefaultsIfNotSet(): $this
Adds the default value if the node is not set in the configuration.
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.
|
#
|
public
|
addDefaultChildrenIfNoneSet(int|string|array|null $children = null): $this
Adds children with a default value when none are defined.
Adds children with a default value when none are defined.
This method is applicable to prototype nodes only.
Parameters
| $children |
The number of children|The child name|The children names to be added
|
|
#
|
public
|
requiresAtLeastOneElement(): $this
Requires the node to have at least one element.
Requires the node to have at least one element.
This method is applicable to prototype nodes only.
|
#
|
public
|
disallowNewKeysInSubsequentConfigs(): $this
Disallows adding news keys in a subsequent configuration.
Disallows adding news keys in a subsequent configuration.
If used all keys have to be defined in the same configuration file.
|
#
|
public
|
fixXmlConfig(string $singular, string|null $plural = null): $this
Sets a normalization rule for XML configurations.
Sets a normalization rule for XML configurations.
Parameters
| $singular |
The key to remap
|
| $plural |
The plural of the key for irregular plurals
|
|
#
|
public
|
useAttributeAsKey(string $name, bool $removeKeyItem = true): $this
Sets the attribute which value is to be used as key.
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:
[
['id' => 'my_name', 'foo' => 'bar'],
];
becomes
[
'my_name' => ['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.
Parameters
| $name |
The name of the key
|
| $removeKeyItem |
Whether or not the key item should be removed
|
|
#
|
public
|
canBeUnset(bool $allow = true): $this
Sets whether the node can be unset.
Sets whether the node can be unset.
|
#
|
public
|
canBeEnabled(): $this
Adds an "enabled" boolean to enable the current section.
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
|
#
|
public
|
canBeDisabled(): $this
Adds an "enabled" boolean to enable the current section.
Adds an "enabled" boolean to enable the current section.
By default, the section is enabled.
|
#
|
public
|
performNoDeepMerging(): $this
Disables the deep merging of the node.
Disables the deep merging of the node.
|
#
|
public
|
ignoreExtraKeys(bool $remove = true): $this
Allows extra config keys to be specified under an array without
throwing an exception.
Allows extra config keys to be specified under an array without
throwing an exception.
Those config values are 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.
Parameters
| $remove |
Whether to remove the extra keys
|
|
#
|
public
|
normalizeKeys(bool $bool): $this
Sets whether to enable key normalization.
Sets whether to enable key normalization.
|
#
|
public
|
append(NodeDefinition $node): static
Appends a node definition.
Appends a node definition.
Usage:
$node = $parentNode
->children()
->scalarNode('foo')->end()
->scalarNode('baz')->end()
->append($this->getBarNodeDefinition())
->end()
;
Implements
|
#
|
protected
|
getNodeBuilder(): NodeBuilder
Returns a node builder to be used to add children and prototype.
Returns a node builder to be used to add children and prototype.
|
#
|
protected
|
createNode(): NodeInterface
Instantiate and configure the node according to this definition.
Instantiate and configure the node according to this definition.
Implements
|
#
|
protected
|
validateConcreteNode(ArrayNode $node): void
Validate the configuration of a concrete node.
Validate the configuration of a concrete node.
Throws
|
#
|
protected
|
validatePrototypeNode(PrototypedArrayNode $node): void
Validate the configuration of a prototype node.
Validate the configuration of a prototype node.
Throws
|
#
|
public
|
getChildNodeDefinitions(): NodeDefinition[]
Gets the child node definitions.
Gets the child node definitions.
Implements
|
#
|
public
|
find(string $nodePath): NodeDefinition
Finds a node defined by the given $nodePath.
Finds a node defined by the given $nodePath.
Parameters
| $nodePath |
The path of the node to find. e.g "doctrine.orm.mappings"
|
|
#
|