-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Assert Valid with many groups #36216
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
src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
Outdated
Show resolved
Hide resolved
if ($constraint instanceof Composite) { | ||
// instanceof Valid: In case of using a Valid constraint with many groups | ||
// it makes a reference object get validated by each group | ||
if ($constraint instanceof Composite || $constraint instanceof Valid) { |
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.
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.
Indeed, looks good to me too.
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.
Thanks for that PR
if ($constraint instanceof Composite) { | ||
// instanceof Valid: In case of using a Valid constraint with many groups | ||
// it makes a reference object get validated by each group | ||
if ($constraint instanceof Composite || $constraint instanceof Valid) { |
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.
Indeed, looks good to me too.
Thank you @phucwan91. |
Make a reference object get validated by each group when using the Valid constraint with many groups