PrototypedArrayNode
class PrototypedArrayNode extends ArrayNode
Represents a prototyped Array node in the config tree.
Constants
DEFAULT_PATH_SEPARATOR |
|
Properties
protected | $name | from BaseNode | |
protected | $parent | from BaseNode | |
protected | $normalizationClosures | from BaseNode | |
protected | $finalValidationClosures | from BaseNode | |
protected | $allowOverwrite | from BaseNode | |
protected | $required | from BaseNode | |
protected | $deprecationMessage | from BaseNode | |
protected | $equivalentValues | from BaseNode | |
protected | $attributes | from BaseNode | |
protected | $pathSeparator | from BaseNode | |
protected | $xmlRemappings | from ArrayNode | |
protected | $children | from ArrayNode | |
protected | $allowFalse | from ArrayNode | |
protected | $allowNewKeys | from ArrayNode | |
protected | $addIfNotSet | from ArrayNode | |
protected | $performDeepMerging | from ArrayNode | |
protected | $ignoreExtraKeys | from ArrayNode | |
protected | $removeExtraKeys | from ArrayNode | |
protected | $normalizeKeys | from ArrayNode | |
protected | $prototype | ||
protected | $keyAttribute | ||
protected | $removeKeyAttribute | ||
protected | $minNumberOfElements | ||
protected | $defaultValue | ||
protected | $defaultChildren |
Methods
No description
Register possible (dummy) values for a dynamic placeholder value.
Sets a common prefix for dynamic placeholder values.
Adds an equivalent value.
Sets the closures used for final validation.
Returns the deprecated message.
Normalizes keys between the different configuration formats.
Normalizes the value.
Merges values together.
Finalizes the value of this node.
Sets the xml remappings that should be performed.
Sets whether to add default values for this array if it has not been defined in any of the configuration files.
Sets whether false is allowed as value indicating that the array should be unset.
Sets whether new keys can be defined in subsequent configurations.
Whether extra keys should just be ignore without an exception.
Returns true when the node has a default value.
Returns the default value of the node.
Remaps multiple singular values to a single plural value.
Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
Sets the attribute which value is to be used as key.
Retrieves the name of the attribute which value should be used as key.
Sets the default value of this node.
Adds default children when none are set.
Retrieves the prototype.
Details
__construct(string|null $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
static void
setPlaceholder(string $placeholder, array $values)
Register possible (dummy) values for a dynamic placeholder value.
Matching configuration values will be processed with a provided value, one by one. After a provided value is successfully processed the configuration value is returned as is, thus preserving the placeholder.
static void
setPlaceholderUniquePrefix(string $prefix)
Sets a common prefix for dynamic placeholder values.
Matching configuration values will be skipped from being processed and are returned as is, thus preserving the placeholder. An exact match provided by {see setPlaceholder()} might take precedence.
setDeprecated(string|null $message)
Sets this node as deprecated.
You can use %node% and %path% placeholders in your message to display, respectively, the node name and its complete path.
protected The
preNormalize($value)
Normalizes keys between the different configuration formats.
Namely, you mostly have foo_bar in YAML while you have foo-bar in XML. After running this method, all keys are normalized to foo_bar.
If you have a mixed key like foo-bar_moo, it will not be altered. The key will also not be altered if the target key already exists.
setAddIfNotSet(bool $boolean)
Sets whether to add default values for this array if it has not been defined in any of the configuration files.
setAllowFalse(bool $allow)
Sets whether false is allowed as value indicating that the array should be unset.
setIgnoreExtraKeys(bool $boolean, bool $remove = true)
Whether extra keys should just be ignore without an exception.
setMinNumberOfElements(int $number)
Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
setKeyAttribute(string $attribute, bool $remove = 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.