8000 Documented the new config prototype shortcuts · symfony/symfony-docs@462c9f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 462c9f3

Browse files
javiereguiluzweaverryan
authored andcommitted
Documented the new config prototype shortcuts
1 parent ec36b1a commit 462c9f3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

components/config/definition.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Or you may define a prototype for each node inside an array node::
174174
$rootNode
175175
->children()
176176
->arrayNode('connections')
177-
->prototype('array')
177+
->arrayPrototype()
178178
->children()
179179
->scalarNode('driver')->end()
180180
->scalarNode('host')->end()
@@ -186,6 +186,12 @@ Or you may define a prototype for each node inside an array node::
186186
->end()
187187
;
188188

189+
.. versionadded:: 3.3
190+
The ``arrayPrototype()`` method (and the related ``booleanPrototype()``
191+
``integerPrototype()``, ``floatPrototype()``, ``scalarPrototype()`` and
192+
``enumPrototype()``) was introduced in Symfony 3.3. In previous versions,
193+
you needed to use ``prototype('array')``, ``prototype('boolean')``, etc.
194+
189195
A prototype can be used to add a definition which may be repeated many times
190196
inside the current node. According to the prototype definition in the example
191197
above, it is possible to have multiple connection arrays (containing a ``driver``,
@@ -229,7 +235,7 @@ A basic prototyped array configuration can be defined as follows::
229235
->fixXmlConfig('driver')
230236
->children()
231237
->arrayNode('drivers')
232-
->prototype('scalar')->end()
238+
->scalarPrototype()->end()
233239
->end()
234240
->end()
235241
;
@@ -260,7 +266,7 @@ A more complex example would be to define a prototyped array with children::
260266
->fixXmlConfig('connection')
261267
->children()
262268
->arrayNode('connections')
263-
->prototype('array')
269+
->arrayPrototype()
264270
->children()
265271
->scalarNode('table')->end()
266272
->scalarNode('user')->end()
@@ -334,7 +340,7 @@ In order to maintain the array keys use the ``useAttributeAsKey()`` method::
334340
->children()
335341
->arrayNode('connections')
336342
->useAttributeAsKey('name')
337-
->prototype('array')
343+
->arrayPrototype()
338344
->children()
339345
->scalarNode('table')->end()
340346
->scalarNode('user')->end()
@@ -549,7 +555,7 @@ tree with ``append()``::
549555
->isRequired()
550556
->requiresAtLeastOneElement()
551557
->useAttributeAsKey('name')
552-
->prototype('array')
558+
->arrayPrototype
553559
->children()
554560
->scalarNode('value')->isRequired()->end()
555561
->end()
@@ -647,7 +653,7 @@ with ``fixXmlConfig()``::
647653
->fixXmlConfig('extension')
648654
->children()
649655
->arrayNode('extensions')
650-
->prototype('scalar')->end()
656+
->scalarPrototype()->end()
651657
->end()
652658
->end()
653659
;

0 commit comments

Comments
 (0)
0