PhlyRestfully icon indicating copy to clipboard operation
PhlyRestfully copied to clipboard

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

Open Wilt opened this issue 12 years ago • 1 comments

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 avatar Oct 15 '13 12:10 Wilt

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

Wilt avatar Oct 17 '13 11:10 Wilt