Skip to content

Commit 0d3fe33

Browse files
craigweaverryan
craig
authored andcommitted
Add documentation for 'useDefaultsIfNotSet()' configuration method
1 parent 11b7207 commit 0d3fe33

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

components/config/definition.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,12 @@ Array node options
151151
Before defining the children of an array node, you can provide options like:
152152

153153
``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.
155155
``requiresAtLeastOneElement()``
156156
There should be at least one element in the array (works only when ``isRequired()`` is also
157157
called).
158+
``addDefaultsIfNotSet()``
159+
If any child nodes have default values, use them if explicit values haven't been provided.
158160

159161
An example of this::
160162

@@ -224,6 +226,16 @@ has a certain value:
224226
->end()
225227
->end()
226228
->end()
229+
->arrayNode('settings')
230+
->useDefaultsIfNotSet()
231+
->children()
232+
->scalarNode('name')
233+
->isRequired()
234+
->cannotBeEmpty()
235+
->defaultValue('value')
236+
->end()
237+
->end()
238+
->end()
227239
->end()
228240
;
229241

0 commit comments

Comments
 (0)