abstract class NodeDefinition implements NodeParentInterface
This class provides a fluent interface for defining a node.
protected | $name | ||
protected | $normalization | ||
protected | $validation | ||
protected | $defaultValue | ||
protected | $default | ||
protected | $required | ||
protected | $deprecationMessage | ||
protected | $merge | ||
protected | $allowEmptyValue | ||
protected | $nullEquivalent | ||
protected | $trueEquivalent | ||
protected | $falseEquivalent | ||
protected | $pathSeparator | ||
protected | $parent | ||
protected | $attributes |
__construct(string|null $name, NodeParentInterface $parent = null) | ||
$this | setParent(NodeParentInterface $parent) Sets the parent node. | |
$this | info(string $info) Sets info message. | |
$this | example(string|array $example) Sets example configuration. | |
$this | attribute(string $key, mixed $value) Sets an attribute on the node. | |
NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null | end() Returns the parent node. | |
NodeInterface | getNode(bool $forceRootNode = false) Creates the node. | |
$this | defaultValue(mixed $value) Sets the default value. | |
$this | isRequired() Sets the node as required. | |
$this | setDeprecated(string $message = 'The child node "%node%" at path "%path%" is deprecated.') Sets the node as deprecated. | |
$this | treatNullLike(mixed $value) Sets the equivalent value used when the node contains null. | |
$this | treatTrueLike(mixed $value) Sets the equivalent value used when the node contains true. | |
$this | treatFalseLike(mixed $value) Sets the equivalent value used when the node contains false. | |
$this | defaultNull() Sets null as the default value. | |
$this | defaultTrue() Sets true as the default value. | |
$this | defaultFalse() Sets false as the default value. | |
ExprBuilder | beforeNormalization() Sets an expression to run before the normalization. | |
$this | cannotBeEmpty() Denies the node value being empty. | |
ExprBuilder | validate() Sets an expression to run for the validation. | |
$this | cannotBeOverwritten(bool $deny = true) Sets whether the node can be overwritten. | |
ValidationBuilder | validation() Gets the builder for validation rules. | |
MergeBuilder | merge() Gets the builder for merging rules. | |
NormalizationBuilder | normalization() Gets the builder for normalization rules. | |
NodeInterface | createNode() Instantiate and configure the node according to this definition. | |
$this | setPathSeparator(string $separator) Set PathSeparator to use. |
string|null | $name | |
NodeParentInterface | $parent |
Sets the parent node.
NodeParentInterface | $parent |
$this |
Sets info message.
string | $info | The info text |
$this |
Sets example configuration.
string|array | $example |
$this |
Sets an attribute on the node.
string | $key | |
mixed | $value |
$this |
Returns the parent node.
NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null | The builder of the parent node |
Creates the node.
bool | $forceRootNode | Whether to force this node as the root node |
NodeInterface |
Sets the default value.
mixed | $value | The default value |
$this |
Sets the node as required.
$this |
Sets the node as deprecated.
You can use %node% and %path% placeholders in your message to display, respectively, the node name and its complete path.
string | $message | Deprecation message |
$this |
Sets the equivalent value used when the node contains null.
mixed | $value |
$this |
Sets the equivalent value used when the node contains true.
mixed | $value |
$this |
Sets the equivalent value used when the node contains false.
mixed | $value |
$this |
Sets null as the default value.
$this |
Sets true as the default value.
$this |
Sets false as the default value.
$this |
Sets an expression to run before the normalization.
ExprBuilder |
Denies the node value being empty.
$this |
Sets an expression to run for the validation.
The expression receives the value of the node and must return it. It can modify it. An exception should be thrown when the node is not valid.
ExprBuilder |
Sets whether the node can be overwritten.
bool | $deny | Whether the overwriting is forbidden or not |
$this |
Gets the builder for validation rules.
ValidationBuilder |
Gets the builder for merging rules.
MergeBuilder |
Gets the builder for normalization rules.
NormalizationBuilder |
Instantiate and configure the node according to this definition.
NodeInterface | $node The node instance |
InvalidDefinitionException | When the definition is invalid |
Set PathSeparator to use.
string | $separator |
$this |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Config/Definition/Builder/NodeDefinition.html