Closed macnibblet closed 11 years ago
Can you provide a full test case please? I'm having trouble fulling understanding the issue and coming up with a reproduce case.
@weierophinney ping
@macnibblet I'm having a hard time writing up a test case. Can you indicate how the controller would be configured with the above (are you calling setIdentifierName()
? Is this happening when calling the collection of children, or retrieving a single child resource, or both?
@macnibblet Finally reproduced. The issue only happens with child collections. When dealing with a single child resource, the self link is created using the set identifier name in the controller, but with collections, this is not the case.
Now that I have a reproduce case, I should be able to fix it.
@macnibblet Can you try this patch, please?
Essentially, when returning a HalCollection from the ResourceController, I'm now passing it the identifier name as set in the controller. The HalLinks plugin then uses this to create the route parameters for the individual resource items in the collection, which generates the appropriate links.
Say we have a the following route
/users/:id/comments/:comment_id
The comments resource would have the identifiercomment_id
But given the structure of my entity
The self link would fail due to the fact it searches the
Comment
object forcomment_id
when it's actually represented asid