-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
(Proposal) Added a note on forms validation #10331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
best_practices/forms.rst
Outdated
public $title; | ||
} | ||
|
||
This make them reusables and independents from the validation rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
independent
best_practices/forms.rst
Outdated
---------- | ||
|
||
Define your validation constraints outside of the forms, for instance directly on the object | ||
class used as data mapper:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe reword it a bit like this:
Do not define your validation constraint with the
constraints
option. Configure them on the object the form is mapped to instead:
👍 I agree |
Hi @xabbuh, thanks for the review :) Thinking about it, is it a good place to add a note about validation groups? Something like:
With a minimal example attached to this note: WDYT? |
I think it would probably be better to put it the other way around:
And then just link this paragraph to the article about validation groups. |
@mickaelandrieu I liked both your original proposal and the reword suggestions made by @xabbuh so I reworded this accordingly. What do you think? Thanks! |
@javiereguiluz you have improved my proposal as always! Thank you 👍 Edit: so we don't add a note about validation groups? |
Validation | ||
---------- | ||
|
||
The `constraints`_ option allows you to attach `validation constraints`_ to any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the doc
or ref
role here instead
I've merged this "as is" and I'll fix the internal links in a separate PR. Thanks Mickaël! |
…ieu, javiereguiluz) This PR was submitted for the 4.1 branch but it was merged into the 2.8 branch instead (closes #10331). Discussion ---------- (Proposal) Added a note on forms validation Hello! regarding the way I validate my forms, I've always found that storing validation rules into my entities is a better idea than using the constraints inside my form types. When I need a really specific control on my form validation, I inject validation groups: do you think it can be viewed as a best practice? Commits ------- 68a7931 Reword 21c4c9f Added a note on forms validation
Hello!
regarding the way I validate my forms, I've always found that storing validation rules into my entities is a better idea than using the constraints inside my form types.
When I need a really specific control on my form validation, I inject validation groups: do you think it can be viewed as a best practice?