I'm looking for some help with a custom configuration parameter I'm trying to implement in Symfony 2.1
I'm new but just working with Symfony so far has been great. I'm now trying to make my bundle more user friendly and configurable using config.yml.
The parameter I'm trying to define is a sequence of default amounts for example in my config I have
mymain:
default_values: [1, 2, 3, 4]
Now with something like that how would you properly use the treebuilder to add the nodes and properly process the configuration?
What I tried was
$rootNode
->children()
->enumNode('default_values')
->values(array(1, 2))
->end()
->end();
With that I am getting the following exception:
Invalid type for path "mymain.defaults". Expected scalar, but got array.
I'd like the configuration to be optional with a default fallback array sequence I specify.
I've also tried the arrayNode but I believe that's for mappings or arrays with key and value pairing which I'm simply trying to configre a sequence of numbers.