Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

Allow HalResources without identifier (singleton resources) #109

@Wilt

Description

@Wilt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions