我用SF3.4编写了一个配置加载器。
我想要拥有:
['mapping' => ['request' => 'a', 'response' => 'b']
具有以下配置:
custom:
mapping:
request: a
response: b
我想要:
['mapping' => ['request' => 'a', 'response' => 'a']
与此:
custom:
mapping: a
我有树生成器
->arrayNode('mapping')
->beforeNormalization()
->ifString()
->then(function($value) { return ['request' => $value, 'response' => $value]; })
->end()
->children()
->scalarNode('request')->isRequired()->end()
->scalarNode('response')->isRequired()->end()
->end()
->end()
有了这个节点配置
['mapping' => ['request' => 'a', 'response' => 'b']
和
['mapping' => ['a']
代替
['mapping' => ['request' => 'a', 'response' => 'b']
和
['mapping' => ['request' => 'a', 'response' => 'a']
未调用beforeNormalization吗?如何获得所需的配置?