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

Skip to content

Support GroupSequence and callable for validation groups #254

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

Merged
merged 1 commit into from
Oct 29, 2015

Conversation

teohhanhui
Copy link
Contributor

Continuing from #250...

I've found out that group sequence providers do not handle cascade well:

symfony/symfony#3622
symfony/symfony#9650
symfony/symfony#11880
symfony/symfony#15666

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)

So a callback to determine the validation groups seems to be the solution...

@teohhanhui teohhanhui force-pushed the validation_groups_dynamic branch from e0454db to 33a5a13 Compare September 1, 2015 14:31
@dunglas
Copy link
Member

dunglas commented Sep 2, 2015

👍

@dunglas
Copy link
Member

dunglas commented Sep 2, 2015

Can you add a test?

@dunglas
Copy link
Member

dunglas commented Sep 22, 2015

Can you also rebase against 1.0?

@teohhanhui
Copy link
Contributor Author

So the current 1.0 is actually an old stable version? Can I just continue targeting 2.0 then? (Since that's what I'm using...)

@teohhanhui teohhanhui force-pushed the validation_groups_dynamic branch 2 times, most recently from a2704e8 to 99253e8 Compare October 6, 2015 15:12
teohhanhui added a commit to teohhanhui/api-platform-docs that referenced this pull request Oct 6, 2015
@dunglas
Copy link
Member

dunglas commented Oct 6, 2015

Yes it looks fine to me to target 2.0 for this feature.

@teohhanhui teohhanhui force-pushed the validation_groups_dynamic branch from 99253e8 to c08b582 Compare October 6, 2015 17:35
@teohhanhui
Copy link
Contributor Author

Added unit test :)

@teohhanhui
Copy link
Contributor Author

But @dunglas I suspect my changes here might have potentially broken some of the metadata (caching?) codes... Any guidance on that?

See Scrutinizer issues... Currently I've only added a workaround at https://github.com/teohhanhui/DunglasApiBundle/blob/c08b582bc7742bd755883f9dc87d91cfde93ae46/Mapping/Loader/ValidatorMetadataLoader.php#L68-L70 (not sure what are the consequences of that)

@dunglas
Copy link
Member

dunglas commented Oct 6, 2015

It's not important because, anyway, the metadata system will be entirely refactored to use the new Symfony PropertyInfo Component.

@dunglas
Copy link
Member

dunglas commented Oct 14, 2015

ping @sroze @theofidry

@theofidry
Copy link
Contributor

Looks good to me.

@teohhanhui teohhanhui force-pushed the validation_groups_dynamic branch from c08b582 to 14fb83b Compare October 15, 2015 07:29
dunglas added a commit that referenced this pull request Oct 29, 2015
Support GroupSequence and callable for validation groups
@dunglas dunglas merged commit 67c47de into api-platform:master Oct 29, 2015
@dunglas
Copy link
Member

dunglas commented Oct 29, 2015

Thank you @teohhanhui!

@teohhanhui teohhanhui deleted the validation_groups_dynamic branch November 2, 2015 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants