I've been trying to make tree builder configuration with Symfony 3 to parse a configuration like that:
my_bundle:
import:
paths:
- 'some/path'
- 'another/path'
My TreeBuilder looks like this:
$rootNode
->children()
->arrayNode('import')
->children()
->arrayNode('paths')
->addDefaultsIfNotSet()
->defaultValue([])
->cannotBeEmpty()
->end()
->end()
->end()
->end();
It is basically like two dimensional array config I would like to get as a result. Could you guys help me figure it out?
Expected parsed config:
['import' => ['paths' => ['some/path', 'another/path']]]
->defaultValue() is not applicable to concrete nodes at path "my_bundle.import.paths"cannotBeEmptyanddefaultValue([])at the same time?[]is empty.cannotBeEmptyis irrelevant at this point. It does even compile as valid configuration tree definition. The thing what I want to achieve is thatpathsarray would be underimportkey on root array.