I created a Configuration class and I build a tree that defines my configuration in that class, also to create a child node I do like that:
->children()
->scalarNode('node1')
->isRequired()
->cannotBeEmpty()->defaultValue('em_profession_label')->end()
->arrayNode('node2')
->isRequired()
->requiresAtLeastOneElement()
->useAttributeAsKey('id')
->prototype('array')
.....
Now my problem when I need to add a new child node in my yml file so I must repeat the code above again and again, then I’m looking for a solution to do it automatically that when I add a new child node without adding a new code in my configuration class…
After your call to
prototype()you can specify what each child node will look like.That means in your YML config file you can define as many nodes as you like as long as they match what you have mapped in your Configuration. For example…