Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Ensure nested validations for Collections happen in a separate context#14786
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Validator] Ensure nested validations for Collections happen in a separate context#14786
Uh oh!
There was an error while loading.Please reload this page.
Conversation
evanpurkhiser commentedMay 30, 2015
| Q | A |
|---|---|
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #14639 |
| License | MIT |
| Doc PR | n/a |
evanpurkhiser commentedJun 9, 2015
Ping@fabpot |
fabpot commentedJun 9, 2015
ping @symfony/deciders |
stof commentedJun 10, 2015
I would like a validation of@webmozart to be sure it is the right fix. I'm not sure the ExecutionContext is meant to be clonable (and different implementations might not share the same ViolationList when cloning btw, which would break this fix) |
evanpurkhiser commentedJun 10, 2015
Hmm, I think thismay have some relation to#11412. Looking at the changes in that fix, indeed maybe cloning the context might not be the right solution. Hopefully@webmozart can comment :-) |
fabpot commentedJun 30, 2015
@webmozart Can you tell us your point of view on this PR? |
xabbuh commentedJul 2, 2015
ping@webmozart |
1 similar comment
reket commentedNov 13, 2015
ping@webmozart |
evanpurkhiser commentedJan 25, 2016
Ping@webmozart on this again :-) |
fabpot commentedMar 4, 2016
@webmozart The change made in this PR is "simple" enough but we really need your help to validate that this is indeed the right way. |
| if ($contextinstanceof ExecutionContextInterface) { | ||
| $context->getValidator() | ||
| ->inContext($context) | ||
| ->inContext(clone$context) |
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.
This solution doesn't work. Now all constraints thrown by the validators in theCollection constraint will be added to the cloned context and not appear in the current context (which is the point of callinginContext()).
webmozart commentedMar 4, 2016
@fabpot Thanks for the ping. Unfortunately this solution would bringe more problems than it would solve. The proper solution is to reset the constraint in the ExecutionContext to the previous one after the nested validation call. We alreadydo the same for the other context properties. We need to add a new method |
webmozart commentedMar 4, 2016
Status: Needs Work |
fabpot commentedJun 9, 2016
Closing as@webmozart mentioned that this is not something we can merge anyway. As there is a corresponding issue, this will still be linked there in case someone want to work on@webmozart suggestion. |
xabbuh commentedNov 28, 2016
see#20664 for an alternative approach |