File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -151,10 +151,12 @@ Array node options
151
151
Before defining the children of an array node, you can provide options like:
152
152
153
153
``useAttributeAsKey() ``
154
- Provide the name of a child node, whose value should be used as the key in the resulting array
154
+ Provide the name of a child node, whose value should be used as the key in the resulting array.
155
155
``requiresAtLeastOneElement() ``
156
156
There should be at least one element in the array (works only when ``isRequired() `` is also
157
157
called).
158
+ ``addDefaultsIfNotSet() ``
159
+ If any child nodes have default values, use them if explicit values haven't been provided.
158
160
159
161
An example of this::
160
162
@@ -224,6 +226,16 @@ has a certain value:
224
226
->end()
225
227
->end()
226
228
->end()
229
+ ->arrayNode('settings')
230
+ ->useDefaultsIfNotSet()
231
+ ->children()
232
+ ->scalarNode('name')
233
+ ->isRequired()
234
+ ->cannotBeEmpty()
235
+ ->defaultValue('value')
236
+ ->end()
237
+ ->end()
238
+ ->end()
227
239
->end()
228
240
;
229
241
You can’t perform that action at this time.
0 commit comments