Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] Allow to pass a single value for the groups opt#27503
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lyrixx commentedJun 5, 2018
Huge 👍 because the previous |
dunglas commentedJun 5, 2018
Travis failure not related. |
fabpot left a comment
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.
Can you add a note in the changelog file?
20uf left a comment
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.
Nice job !
| if (isset($context[static::GROUPS]) &&\is_array($context[static::GROUPS])) { | ||
| $groups =$context[static::GROUPS]; | ||
| if (isset($context[static::GROUPS])) { | ||
| $groups =(array)$context[static::GROUPS]; |
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.
shouldn't this check is_scalar||is_array instead of casting objects?
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.
done
nicolas-grekas commentedJul 1, 2018
Thank you@dunglas. |
…ps opt (dunglas)This PR was merged into the 4.2-dev branch.Discussion----------[Serializer] Allow to pass a single value for the groups opt| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a| License | MIT| Doc PR | todoShortcut syntax similar to#20509 but for the context: allows to pass a string instead of an array of string in the serialization context when only one group if used.Before:```php$serializer->serialize($foo, 'json', ['groups' => ['myGroup']];/** @ApiResource(normalizationContext={"groups"={"myGroup"}}) */```After:```php$serializer->serialize($foo, 'json', ['groups' => 'myGroup'];/** @ApiResource(normalizationContext={"groups"="myGroup") */```Commits-------5b39203 [Serializer] Allow to pass a single value for the groups opt
… opt (dunglas, javiereguiluz)This PR was merged into the master branch.Discussion----------[Serializer] Allow to pass a single value for the groups optsymfony/symfony#27503Commits-------ae558f4 Added the missing versionadded directivee4eae25 Replaced a "note" by a "tip"5e0a91e [Serializer] Allow to pass a single value for the groups opt
Uh oh!
There was an error while loading.Please reload this page.
Shortcut syntax similar to#20509 but for the context: allows to pass a string instead of an array of string in the serialization context when only one group if used.
Before:
After: