Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Closed
evanpurkhiser wants to merge1 commit intosymfony:2.6fromevanpurkhiser:fixup/collection-validation-context
Closed

[Validator] Ensure nested validations for Collections happen in a separate context#14786

evanpurkhiser wants to merge1 commit intosymfony:2.6fromevanpurkhiser:fixup/collection-validation-context

Conversation

@evanpurkhiser
Copy link

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#14639
LicenseMIT
Doc PRn/a

@evanpurkhiser
Copy link
Author

Ping@fabpot

@fabpot
Copy link
Member

ping @symfony/deciders

@stof
Copy link
Member

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
Copy link
Author

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
Copy link
Member

@webmozart Can you tell us your point of view on this PR?

@xabbuh
Copy link
Member

ping@webmozart

1 similar comment
@reket
Copy link

ping@webmozart

@evanpurkhiser
Copy link
Author

Ping@webmozart on this again :-)

@javiereguiluzjaviereguiluz added Bug and removed Ready labelsMar 3, 2016
@fabpot
Copy link
Member

@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)
Copy link
Contributor

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
Copy link
Contributor

@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 methodgetConstraint() to ExecutionContext in order to do this. When we switch to 4.0, the method should be added to ExecutionContextInterface as well.

@webmozart
Copy link
Contributor

Status: Needs Work

@fabpot
Copy link
Member

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
Copy link
Member

see#20664 for an alternative approach

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

10 participants

@evanpurkhiser@fabpot@stof@xabbuh@reket@webmozart@javiereguiluz@jakzal@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp