I would like to add a simple list of values in a configuration files (config.yml). For example :
my_bundle:
columns: ["col1", "col2"]
When adding the node to the configuration parser, it simply fails :
$rootNode = $treeBuilder->root('my_bundle');
$rootNode->arrayNode('columns')->children()->end();
Here is the error :
InvalidConfigurationException: Unrecognized options "0, 1" under "my_bundle.columns"
What am I missing? Is this even possible?
If you want to achieve a node like this, just do:
$rootNode
->children()
->arrayNode('columns')
->prototype('scalar')
->end()
->end()
->end()
;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With