Skip to content

[Serializer] Supports hassers and setters for groups annotations #14187

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
Apr 27, 2015

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Apr 2, 2015

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

For more coherence with the new ObjectNormalizer (#13257), this PR allows to add @Groups annotations on hasser and setter methods too.

@dunglas
Copy link
Member Author

dunglas commented Apr 14, 2015

ping @symfony/deciders

@@ -22,18 +22,21 @@ class GroupDummy extends GroupDummyParent implements GroupDummyInterface
* @Groups({"a"})
*/
private $foo;
/**
* @Groups({"b", "c"})
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this present before? Can it safely be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's safe, I've just moved them on other supported methods.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you test "hasser" ?

@jakzal
Copy link
Contributor

jakzal commented Apr 15, 2015

looks good to me 👍

@aitboudad
Copy link
Contributor

👍

2 similar comments
@stloyd
Copy link
Contributor

stloyd commented Apr 15, 2015

👍

@xabbuh
Copy link
Member

xabbuh commented Apr 15, 2015

👍

@dunglas
Copy link
Member Author

dunglas commented Apr 21, 2015

Ok to merge it in 2.7?

@aitboudad
Copy link
Contributor

@dunglas #13505 (comment) :)

@dunglas
Copy link
Member Author

dunglas commented Apr 21, 2015

@aitboudad I know that but it can be considered as part of the "serializer groups" and "object normalizer" feature and those features have been released with the beta ;)

I think it's better to have polished features in 2.7 stable and this is some polish.

@dunglas
Copy link
Member Author

dunglas commented Apr 21, 2015

Btw the PR was open 8 days before the release of the beta.

@stloyd
Copy link
Contributor

stloyd commented Apr 21, 2015

IMO it's totally correct to have this in 2.7 as this is addition to new feature introduced in that version, so it's like "bugfix" ;)

@aitboudad
Copy link
Contributor

well I think this can be considered as a bugfix.
@dunglas Is there a use case for adding setters supports ?

@dunglas
Copy link
Member Author

dunglas commented Apr 21, 2015

@aitboudad it's a matter of taste but I think yes. In fact this PR is derived from a use case in a project I work on:

  • I have 2 groups: one for normalization, another for denormalization
  • I set my groups on interfaces trough annotations (so no property available)
  • I like to put my denormalization group definitions on setters, I think it's easier to find them as it's a mutation operation than when they are on a getter.

@dunglas dunglas merged commit 9c87ecc into symfony:2.7 Apr 27, 2015
dunglas added a commit that referenced this pull request Apr 27, 2015
…nnotations (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] Supports hassers and setters for groups annotations

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

For more coherence with the new `ObjectNormalizer` (#13257), this PR allows to add `@Groups` annotations on hasser and setter methods too.

Commits
-------

9c87ecc [Serializer] Supports hassers and setters for groups annotations
@dunglas dunglas deleted the enhanced_groups branch December 5, 2015 09:02
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.

6 participants