Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This add another extraction strategy (I think we all have them now), that I called PASS_THRU. Basically, it allows a parent hydrator to decide how to extract child resources, and is a hint to a renderer to use this representation.
For instance, let's say you have a User with a roles ManyToMany associations. If you use the "ID" strategy, you'll have a payload that looks like this:
If you use "EMBED", it will use the hydrator attached to the Role entity, and payload will look like this:
However for those cases, what we prefer is to have a simpler representation as array:
This PASS_THRU extraction policy is made for that: you can decide that for this specification association, it's up to the parent hydrator (in this case, the UserHydrator) to decide how to represent this nested resource. For instance, you can write a UserHydrator that builds itself how roles are represented:
And here is how you can configure the association:
Let me know if you like the idea :)
ping @danizord @Ocramius