Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rpg600
Copy link
Contributor

@rpg600 rpg600 commented Aug 30, 2015

…operties

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

In a group sequence, all properties (and cascaded ones) hosted on class A and belonging to the Default group implicitly belong to the group A. However even if we explicitly set a group for cascaded properties, the Default group is always propagated making it impossible to validate our cascaded properties.
For explicit groups the Default group must not be propagated.

Here is an example of use case https://gist.github.com/rpg600/abb765ad2d4446d52e0b that will be fixed.

@rpg600
Copy link
Contributor Author

rpg600 commented Sep 2, 2015

Ping @webmozart

@teohhanhui
Copy link
Contributor

According to JSR303:

Note however that the Default group sequence overriding is local to the class it is defined on and is not propagated to the associated objects.

(Also see Example 3.12 under the same section)

@webmozart
Copy link
Contributor

Hi @rpg600! :) As you can read in @teohhanhui's quote, this is not a bug but an intended feature. However, you can explicitly pass the GroupSequence to the validator instead of redefining the Default group:

$violations = $validator->validate($user, new GroupSequence(['User', 'UserAddress']));

This should fix your problem.

@webmozart webmozart closed this Dec 21, 2015
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.

4 participants