Skip to content

Commit ac05a6e

Browse files
committed
Minor tweaks
1 parent 8db6dc3 commit ac05a6e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

components/options_resolver.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,16 @@ In same way, parent options can access to the nested options as normal arrays::
720720
Prototype Options
721721
~~~~~~~~~~~~~~~~~
722722

723+
.. versionadded:: 5.3
724+
725+
Prototype options were introduced in Symfony 5.3.
726+
723727
There are situations where you will have to resolve and validate a set of
724728
options that may repeat many times within another option. Let's imagine a
725729
``connections`` option that will accept an array of database connections
726730
with ``host``, ``database``, ``user`` and ``password`` each.
727731

728-
To achieve it, you can establish the nested definition of this ``connections``
729-
option as prototype::
732+
The best way to implement this is to define the ``connections`` option as prototype::
730733

731734
$resolver->setDefault('connections', function (OptionsResolver $connResolver) {
732735
$connResolver
@@ -736,7 +739,7 @@ option as prototype::
736739
});
737740

738741
According to the prototype definition in the example above, it is possible
739-
to have multiple connection arrays like following::
742+
to have multiple connection arrays like the following::
740743

741744
$resolver->resolve([
742745
'connections' => [
@@ -755,16 +758,13 @@ to have multiple connection arrays like following::
755758
]);
756759

757760
The array keys (``default``, ``test``, etc.) of this prototype option are
758-
validation-free and can be any valid key you want to differentiate the connections.
761+
validation-free and can be any arbitrary value that helps differentiate the
762+
connections.
759763

760764
.. note::
761765

762766
A prototype option can only be defined inside a nested option and
763-
during its resolution it will expect an array of array.
764-
765-
.. versionadded:: 5.3
766-
767-
The ``setPrototype()`` method was introduced in Symfony 5.3.
767+
during its resolution it will expect an array of arrays.
768768

769769
Deprecating the Option
770770
~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)