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] ensure the proper context for nested validations #20664

Merged
merged 1 commit into from Nov 29, 2016

Conversation

Projects
None yet
4 participants
@xabbuh
Copy link
Member

commented Nov 28, 2016

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #14639, #20368
License MIT
Doc PR n/a

@xabbuh xabbuh force-pushed the xabbuh:issue-14786 branch from 695e200 to 56c8ff8 Nov 28, 2016

@HeahDude

This comment has been minimized.

Copy link
Member

commented Nov 28, 2016

A necessary feature since 2.7 is LTS and this bug's really tricky
👍

@@ -110,6 +111,11 @@ public function validate($value, $constraints = null, $groups = null)
$previousMetadata = $this->context->getMetadata();
$previousPath = $this->context->getPropertyPath();
$previousGroup = $this->context->getGroup();
$previousConstraint = null;
if ($this->context instanceof ExecutionContext || method_exists($this->context, 'getConstraint')) {

This comment has been minimized.

Copy link
@ogizanagi

ogizanagi Nov 28, 2016

Member

Why not just if (method_exists($this->context, 'getConstraint')) ?

This comment has been minimized.

Copy link
@xabbuh

xabbuh Nov 28, 2016

Author Member

I did not test it, but the instanceof check should be faster and should be true most of the time.

@fabpot

This comment has been minimized.

Copy link
Member

commented Nov 29, 2016

Thank you @xabbuh.

@fabpot fabpot merged commit 56c8ff8 into symfony:2.7 Nov 29, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Nov 29, 2016

bug #20664 [Validator] ensure the proper context for nested validatio…
…ns (xabbuh)

This PR was merged into the 2.7 branch.

Discussion
----------

[Validator] ensure the proper context for nested validations

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14639, #20368
| License       | MIT
| Doc PR        | n/a

Commits
-------

56c8ff8 ensure the proper context for nested validations

@xabbuh xabbuh deleted the xabbuh:issue-14786 branch Nov 29, 2016

@fabpot fabpot referenced this pull request Nov 30, 2016

Merged

Release v3.2.0 #20693

This was referenced Dec 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.