Skip to content

Commit e05e507

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Minor (language) improvements
2 parents 22217fa + 4fbc71f commit e05e507

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
@@ -891,13 +891,13 @@ Form Type Guessing
891891
~~~~~~~~~~~~~~~~~~
892892

893893
If the object handled by the form includes validation constraints, Symfony can
894-
introspect that metadata to guess the type of your field and set it up for you.
895-
In the above example, Symfony can guess from the validation rules that both the
894+
introspect that metadata to guess the type of your field.
895+
In the above example, Symfony can guess from the validation rules that the
896896
``task`` field is a normal ``TextType`` field and the ``dueDate`` field is a
897897
``DateType`` field.
898898

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

902902
// src/Form/Type/TaskType.php
903903
namespace App\Form\Type;
@@ -932,23 +932,21 @@ pass ``null`` to it, to enable Symfony's "guessing mechanism"::
932932
Form Type Options Guessing
933933
..........................
934934

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

939938
``required``
940-
The ``required`` option can be guessed based on the validation rules (i.e. is
939+
The ``required`` option is guessed based on the validation rules (i.e. is
941940
the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata (i.e. is the
942941
field ``nullable``). This is very useful, as your client-side validation will
943942
automatically match your validation rules.
944943

945944
``maxlength``
946945
If the field is some sort of text field, then the ``maxlength`` option attribute
947-
can be guessed from the validation constraints (if ``Length`` or ``Range`` is used)
946+
is guessed from the validation constraints (if ``Length`` or ``Range`` is used)
948947
or from the :doc:`Doctrine </doctrine>` metadata (via the field's length).
949948

950-
If you'd like to change one of the guessed values, override it by passing the
951-
option in the options field array::
949+
If you'd like to change one of the guessed values, override it in the options field array::
952950

953951
->add('task', null, ['attr' => ['maxlength' => 4]])
954952

0 commit comments

Comments
 (0)