I have a problem with Symfony4 bundle configuration. I have a configuration class with:
$rootNode
->children()
->arrayNode('mapping')
->useAttributeAsKey('code')
->prototype('scalar')->end()
->defaultValue(['default' => 'test'])
->end()
.....
->end();
This returns a default configuration like:
array(1) {
["default"]=> string(4) "test"
}
But when I add a configuration file:
bundle:
mapping:
test: newvalue
test2: newvalue2
Im getting a config:
array(2) {
["test"]=> string(8) "newvalue"
["test2"]=> string(9) "newvalue2"
}
But I expect to merge these two configs to get:
array(3) {
["default"]=> string(4) "test"
["test"]=> string(8) "newvalue"
["test2"]=> string(9) "newvalue2"
}
How can I set this defaults to be merged with provided configurations? Of course I want to let "default" config to be overridden, but by deafult to be merged.
I cant find any solution on docs https://symfony.com/doc/current/components/config/definition.html#array-node-options
Please help :)