Some of the features of my bundle are optional. In order to configure them, I'd like to have the following two options. If I want to enable the feature:
foo:
feature:
mandatory1: 'bar'
mandatory2: 'bar2'
However, if I decide to not use this specific feature, I'd like to set feature to be null:
foo:
feature: ~
I currently have the following code:
// ...
->arrayNode('feature')
->defaultNull()
->children()
->scalarNode('mandatory1')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('mandatory2')
->isRequired()
->cannotBeEmpty()
->end()
->end()
->end()
However, the defaultNull() call is not allowed. Is there any way I can achieve this behaviour?