Symfony\Component\Config\Definition\PrototypedArrayNode::setDefaultValue PHP Method

setDefaultValue() public method

Sets the default value of this node.
public setDefaultValue ( string $value )
$value string
    public function setDefaultValue($value)
    {
        if (!is_array($value)) {
            throw new \InvalidArgumentException($this->getPath() . ': the default value of an array node has to be an array.');
        }
        $this->defaultValue = $value;
    }

Usage Example

 public function testGetDefaultValueReturnsDefaultValueForPrototypes()
 {
     $node = new PrototypedArrayNode('root');
     $prototype = new ArrayNode(null, $node);
     $node->setPrototype($prototype);
     $node->setDefaultValue(array('test'));
     $this->assertEquals(array('test'), $node->getDefaultValue());
 }
All Usage Examples Of Symfony\Component\Config\Definition\PrototypedArrayNode::setDefaultValue