Class

Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition

class ScalarNodeDefinition extends VariableNodeDefinition

This class provides a fluent interface for defining a node.

Methods

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

Constructor

from NodeDefinition
NodeDefinition setParent(NodeParentInterface $parent)

Sets the parent node

from NodeDefinition
NodeParentInterface end()

Returns the parent node.

from NodeDefinition
NodeInterface getNode(Boolean $forceRootNode = false)

Creates the node.

from NodeDefinition
NodeDefinition defaultValue(mixed $value)

Sets the default value.

from NodeDefinition
NodeDefinition isRequired()

Sets the node as required.

from NodeDefinition
NodeDefinition treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

from NodeDefinition
NodeDefinition treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

from NodeDefinition
NodeDefinition treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

from NodeDefinition
NodeDefinition defaultNull()

Sets null as the default value.

from NodeDefinition
NodeDefinition defaultTrue()

Sets true as the default value.

from NodeDefinition
NodeDefinition defaultFalse()

Sets false as the default value.

from NodeDefinition
ExprBuilder beforeNormalization()

Sets an expression to run before the normalization.

from NodeDefinition
NodeDefinition cannotBeEmpty()

Denies the node value being empty.

from NodeDefinition
ExprBuilder validate()

Sets an expression to run for the validation.

from NodeDefinition
NodeDefinition cannotBeOverwritten(Boolean $deny = true)

Sets whether the node can be overwritten.

from NodeDefinition

Details

in NodeDefinition at line 42
public __construct(string $name, NodeParentInterface $parent = null)

Constructor

Parameters

string $name The name of the node
NodeParentInterface $parent The parent

in NodeDefinition at line 59
public NodeDefinition setParent(NodeParentInterface $parent)

Sets the parent node

Parameters

NodeParentInterface $parent The parent

Return Value

NodeDefinition

in NodeDefinition at line 71
public NodeParentInterface end()

Returns the parent node.

Return Value

NodeParentInterface The builder of the parent node

in NodeDefinition at line 83
public NodeInterface getNode(Boolean $forceRootNode = false)

Creates the node.

Parameters

Boolean $forceRootNode Whether to force this node as the root node

Return Value

NodeInterface

in NodeDefinition at line 107
public NodeDefinition defaultValue(mixed $value)

Sets the default value.

Parameters

mixed $value The default value

Return Value

NodeDefinition

in NodeDefinition at line 120
public NodeDefinition isRequired()

Sets the node as required.

Return Value

NodeDefinition

in NodeDefinition at line 134
public NodeDefinition treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line 148
public NodeDefinition treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line 162
public NodeDefinition treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line 174
public NodeDefinition defaultNull()

Sets null as the default value.

Return Value

NodeDefinition

in NodeDefinition at line 184
public NodeDefinition defaultTrue()

Sets true as the default value.

Return Value

NodeDefinition

in NodeDefinition at line 194
public NodeDefinition defaultFalse()

Sets false as the default value.

Return Value

NodeDefinition

in NodeDefinition at line 218
public ExprBuilder beforeNormalization()

Sets an expression to run before the normalization.

Return Value

ExprBuilder

in NodeDefinition at line 228
public NodeDefinition cannotBeEmpty()

Denies the node value being empty.

Return Value

NodeDefinition

in NodeDefinition at line 258
public ExprBuilder validate()

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.

Return Value

ExprBuilder

in NodeDefinition at line 284
public NodeDefinition cannotBeOverwritten(Boolean $deny = true)

Sets whether the node can be overwritten.

Parameters

Boolean $deny Whether the overwriting is forbidden or not

Return Value

NodeDefinition