我一直在努力使树构建配置与Symfony的3解析这样的配置:Symfony的配置树构建
my_bundle:
import:
paths:
- 'some/path'
- 'another/path'
我TreeBuilder作为看起来是这样的:
$rootNode
->children()
->arrayNode('import')
->children()
->arrayNode('paths')
->addDefaultsIfNotSet()
->defaultValue([])
->cannotBeEmpty()
->end()
->end()
->end()
->end();
它基本上是喜欢二维数组配置我想得到的结果。你们能帮我弄清楚吗?
预计解析的配置:
['import' => ['paths' => ['some/path', 'another/path']]]
什么你明白呢? –
' - > defaultValue()不适用于路径为“my_bundle.import.paths”的具体节点 – Aistis
您想要归档哪种行为?为什么你同时应用'cannotBeEmpty'和'defaultValue([])'? '[]'**是空的。 –