PHP Class Symfony\Component\Config\Definition\PrototypedArrayNode

Author: Johannes M. Schmitt ([email protected])
Inheritance: extends Symfony\Component\Config\Definition\ArrayNode
Datei anzeigen Open project: symfony/symfony Class Usage Examples

Protected Properties

Property Type Description
$defaultChildren
$defaultValue
$keyAttribute
$minNumberOfElements
$prototype
$removeKeyAttribute

Public Methods

Method Description
addChild ( Symfony\Component\Config\Definition\NodeInterface $node ) Disable adding concrete children for prototyped nodes.
getDefaultValue ( ) : array Retrieves the default value.
getKeyAttribute ( ) : string Retrieves the name of the attribute which value should be used as key.
getPrototype ( ) : Symfony\Component\Config\Definition\PrototypeNodeInterface Retrieves the prototype.
hasDefaultValue ( ) : boolean Checks if the node has a default value.
setAddChildrenIfNoneSet ( integer | string | array | null $children = ['defaults'] ) Adds default children when none are set.
setDefaultValue ( string $value ) Sets the default value of this node.
setKeyAttribute ( string $attribute, boolean $remove = true ) Sets the attribute which value is to be used as key.
setMinNumberOfElements ( integer $number ) Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
setPrototype ( Symfony\Component\Config\Definition\PrototypeNodeInterface $node ) Sets the node prototype.

Protected Methods

Method Description
finalizeValue ( mixed $value ) : mixed Finalizes the value of this node.
mergeValues ( mixed $leftSide, mixed $rightSide ) : mixed Merges values together.
normalizeValue ( mixed $value ) : mixed Normalizes the value.

Private Methods

Method Description
getPrototypeForChild ( string $key ) : mixed Returns a prototype for the child node that is associated to $key in the value array.

Method Details

addChild() public method

Disable adding concrete children for prototyped nodes.
public addChild ( Symfony\Component\Config\Definition\NodeInterface $node )
$node Symfony\Component\Config\Definition\NodeInterface The child node to add

finalizeValue() protected method

Finalizes the value of this node.
protected finalizeValue ( mixed $value ) : mixed
$value mixed
return mixed The finalized value

getDefaultValue() public method

The default value could be either explicited or derived from the prototype default value.
public getDefaultValue ( ) : array
return array The default value

getKeyAttribute() public method

Retrieves the name of the attribute which value should be used as key.
public getKeyAttribute ( ) : string
return string The name of the attribute

getPrototype() public method

Retrieves the prototype.
public getPrototype ( ) : Symfony\Component\Config\Definition\PrototypeNodeInterface
return Symfony\Component\Config\Definition\PrototypeNodeInterface The prototype

hasDefaultValue() public method

Checks if the node has a default value.
public hasDefaultValue ( ) : boolean
return boolean

mergeValues() protected method

Merges values together.
protected mergeValues ( mixed $leftSide, mixed $rightSide ) : mixed
$leftSide mixed The left side to merge
$rightSide mixed The right side to merge
return mixed The merged values

normalizeValue() protected method

Normalizes the value.
protected normalizeValue ( mixed $value ) : mixed
$value mixed The value to normalize
return mixed The normalized value

setAddChildrenIfNoneSet() public method

Adds default children when none are set.
public setAddChildrenIfNoneSet ( integer | string | array | null $children = ['defaults'] )
$children integer | string | array | null The number of children|The child name|The children names to be added

setDefaultValue() public method

Sets the default value of this node.
public setDefaultValue ( string $value )
$value string

setKeyAttribute() public method

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.
public setKeyAttribute ( string $attribute, boolean $remove = true )
$attribute string The name of the attribute which value is to be used as a key
$remove boolean Whether or not to remove the key

setMinNumberOfElements() public method

Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
public setMinNumberOfElements ( integer $number )
$number integer

setPrototype() public method

Sets the node prototype.
public setPrototype ( Symfony\Component\Config\Definition\PrototypeNodeInterface $node )
$node Symfony\Component\Config\Definition\PrototypeNodeInterface

Property Details

$defaultChildren protected_oe property

protected $defaultChildren

$defaultValue protected_oe property

protected $defaultValue

$keyAttribute protected_oe property

protected $keyAttribute

$minNumberOfElements protected_oe property

protected $minNumberOfElements

$prototype protected_oe property

protected $prototype

$removeKeyAttribute protected_oe property

protected $removeKeyAttribute