8000 minor #13593 Update forms.rst (yyaremenko) · githubfromgui/symfony-docs@a2d1dd8 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2d1dd8

Browse files
committed
minor symfony#13593 Update forms.rst (yyaremenko)
This PR was merged into the 4.4 branch. Discussion ---------- Update forms.rst increase emphasis on the two ways (approaches) of adding constraints in Symfony <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 4e6fd23 Update forms.rst
2 parents 1a19dd5 + 4e6fd23 commit a2d1dd8

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

forms.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,15 @@ Before using validation, add support for it in your application:
459459
460460
$ composer require symfony/validator
461461
462-
Validation is done by adding a set of rules (called constraints) to a class. To
463-
see this in action, add validation constraints so that the ``task`` field cannot
464-
be empty and the ``dueDate`` field cannot be empty and must be a valid \DateTime
462+
Validation is done by adding a set of rules, called (validation) constraints,
463+
to a class.
464+
465+
There are two approaches - you can either add the constraints to the entity,
466+
or you can add the constraints to the form.
467+
468+
To see the first approach - adding constraints to the entity - in action,
469+
add the validation constraints, so that the ``task`` field cannot be empty,
470+
and the ``dueDate`` field cannot be empty, and must be a valid \DateTime
465471
object.
466472

467473
.. configuration-block::
@@ -544,9 +550,11 @@ object.
544550
}
545551
546552
That's it! If you re-submit the form with invalid data, you'll see the
547-
corresponding errors printed out with the form. Read the
548-
:doc:`Symfony validation documentation </validation>` to learn more about this
549-
powerful feature.
553+
corresponding errors printed out with the form.
554+
555+
To see the second approach - adding constraints to the form and to
556+
learn more about the validation constraints, please refer to the
557+
:doc:`Symfony validation documentation </validation>`.
550558

551559
Other Common Form Features
552560
--------------------------

0 commit comments

Comments
 (0)
0