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

Allow HalResources without identifier (singleton resources) #109

Open
Wilt opened this issue Sep 12, 2013 · 0 comments
Open

Allow HalResources without identifier (singleton resources) #109

Wilt opened this issue Sep 12, 2013 · 0 comments

Comments

@Wilt
Copy link
Contributor

Wilt commented Sep 12, 2013

What if I want to embed a resource which is not part of a collection, but a single resource without an Id.
For example users/:user_id/address
I do not need an identifier because the user has only one id. An id is not necessary.
When I instantiate HalResource i can do this new HalResource(array, false); Which works totally fine. But the MetaMap doesn't allow me to define a resource map without defining an identifier_name. If i put false or null the HalLinks.php triggers an Exception\RuntimeException saying "Unable to determine identifier for object". I think it should be possible to define single resources without a parent collection and an id. This is conform RESTful definitions.
I also don't manage mapping routes without an id to the right actions in the controller. This has to do with the extension of the zf2 AbstractRestfulController. That is where routes without ids are mapped to the collection actions (getList, updateList, etc).

To allow support of singleton resources in PhlyRestfully seems to be complicated. But it would be great if it would be supported in the future.

weierophinney pushed a commit that referenced this issue May 26, 2016
This change allows registering a single HalResource without an identifier. See for more details this issue:
#109
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