Skip to content
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

Attributes (first-class properties) not rendered when embedding collection #115

Open
Wilt opened this issue Oct 15, 2013 · 1 comment
Open

Comments

@Wilt
Copy link
Contributor

Wilt commented Oct 15, 2013

If I embed a HalCollection in another HalResource the attributes are not rendered in the Json result. This seems wrong to me since those are first-class properties of the resource. They are part of the resource collection definition.

@Wilt
Copy link
Contributor Author

Wilt commented Oct 17, 2013

A solution would be to provide the user in the config file of PhlyRestfully an option/choice how to render embedded collections. The whole collection resource (including the collection attributes and _links) or only the extracted array of items from the collection resource.
The difference lies here: https://github.com/phly/PhlyRestfully/blob/master/src/PhlyRestfully/Plugin/HalLinks.php#L765
In the first case (embedding the whole collection) the function line 765 should be renderCollection, in the second case the function on line 765 should be extractCollection. Both solutions render a correct result which is fully compliant to the HAL specs. It just allows the user a choice how to embed his collections. It also solves another problem I ran into while using the module which I mentioned here: http://stackoverflow.com/questions/19400784/no-self-href-in-embedded-hal-resource-collection

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

No branches or pull requests

1 participant