-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] group constraints when calling the validator #34464
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
[Form] group constraints when calling the validator #34464
Conversation
d571d2f
to
d15f77f
Compare
@@ -97,6 +99,10 @@ public function validate($form, Constraint $formConstraint) | |||
} | |||
} | |||
} | |||
|
|||
foreach ($groupedConstraints as $group => $constraint) { |
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.
- constraint
+ constraints
?
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.
That would override the $constraints
variable used above.
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 name it $constraintsInGroup
or so? Slightly confusing otherwise 🙈
…as-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [Form] group constraints when calling the validator | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of #34081 Spotted during the workshop at SymfonyCon, while trying to fix deprecation notices on symfony-demo: the Form component currently passes constraints one by one for validation, effectively preventing the validator from taking care of cross-constraints dependencies. This PR fixes it. This will prevent ppl from having to fix things like > Using the "Symfony\Component\Validator\Constraints\Length" constraint with the "min" option without setting the "allowEmptyString" one is deprecated and defaults to true. In 5.0, it will become optional and default to false. Commits ------- d15f77f [Form] group constraints when calling the validator
Follow up of #34081
Spotted during the workshop at SymfonyCon, while trying to fix deprecation notices on symfony-demo:
the Form component currently passes constraints one by one for validation, effectively preventing the validator from taking care of cross-constraints dependencies.
This PR fixes it.
This will prevent ppl from having to fix things like