Skip to content

Commit 4fbc71f

Browse files
committed
minor #17336 [Form] Minor (language) improvements (ThomasLandauer)
This PR was merged into the 4.4 branch. Discussion ---------- [Form] Minor (language) improvements Most important: Changing the ambiguous "**can** be guessed" to "**will** be guessed". Commits ------- 0caef0b Minor (language) improvements
2 parents fcb9e8f + 0caef0b commit 4fbc71f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

forms.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -840,13 +840,13 @@ Form Type Guessing
840840
~~~~~~~~~~~~~~~~~~
841841

842842
If the object handled by the form includes validation constraints, Symfony can
843-
introspect that metadata to guess the type of your field and set it up for you.
844-
In the above example, Symfony can guess from the validation rules that both the
843+
introspect that metadata to guess the type of your field.
844+
In the above example, Symfony can guess from the validation rules that the
845845
``task`` field is a normal ``TextType`` field and the ``dueDate`` field is a
846846
``DateType`` field.
847847

848-
When building the form, omit the second argument to the ``add()`` method, or
849-
pass ``null`` to it, to enable Symfony's "guessing mechanism"::
848+
To enable Symfony's "guessing mechanism", omit the second argument to the ``add()`` method, or
849+
pass ``null`` to it::
850850

851851
// src/Form/Type/TaskType.php
852852
namespace App\Form\Type;
@@ -881,23 +881,21 @@ pass ``null`` to it, to enable Symfony's "guessing mechanism"::
881881
Form Type Options Guessing
882882
..........................
883883

884-
When the guessing mechanism is enabled for some field (i.e. you omit or pass
885-
``null`` as the second argument to ``add()``), in addition to its form type,
886-
the following options can be guessed too:
884+
When the guessing mechanism is enabled for some field, in addition to its form type,
885+
the following options will be guessed too:
887886

888887
``required``
889-
The ``required`` option can be guessed based on the validation rules (i.e. is
888+
The ``required`` option is guessed based on the validation rules (i.e. is
890889
the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata (i.e. is the
891890
field ``nullable``). This is very useful, as your client-side validation will
892891
automatically match your validation rules.
893892

894893
``maxlength``
895894
If the field is some sort of text field, then the ``maxlength`` option attribute
896-
can be guessed from the validation constraints (if ``Length`` or ``Range`` is used)
895+
is guessed from the validation constraints (if ``Length`` or ``Range`` is used)
897896
or from the :doc:`Doctrine </doctrine>` metadata (via the field's length).
898897

899-
If you'd like to change one of the guessed values, override it by passing the
900-
option in the options field array::
898+
If you'd like to change one of the guessed values, override it in the options field array::
901899

902900
->add('task', null, ['attr' => ['maxlength' => 4]])
903901

0 commit comments

Comments
 (0)