Skip to content
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

[Validator] Assert Valid with many groups #36216

Merged
merged 1 commit into from Mar 28, 2020
Merged

Conversation

phucwan91
Copy link
Contributor

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #36157
License MIT

Make a reference object get validated by each group when using the Valid constraint with many groups

@nicolas-grekas nicolas-grekas changed the title [Validator] Assert Valid with many groups #36157 [Validator] Assert Valid with many groups Mar 26, 2020
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HeahDude @stof The proposed change is similar to #29499 that we discussed during SymfonyCon Lisbon. To me this looks good but I would like to get your opinion on this too.

Copy link
Contributor

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.

@phucwan91
Copy link
Contributor Author

FYI, the issue #27257 is completely the same as the current issue (#36157)
so I'm sure this PR can solved the both issues 😁

Copy link
Contributor

@HeahDude HeahDude left a 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) {
Copy link
Contributor

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.

@xabbuh
Copy link
Member

xabbuh commented Mar 28, 2020

Thank you @phucwan91.

@xabbuh xabbuh merged commit 0469be9 into symfony:3.4 Mar 28, 2020
This was referenced Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants