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.

Use metadata map when rendering collections of "related" resources #102

@ivan-novakov

Description

@ivan-novakov

Suppose we have users and groups resources with the corresponding routes - /users[/:id] and /groups[/:id].

If I need to list users which are members of a group I have to use a "child" resource with a route /groups/:id/users, which returns a collection of users.

I followed the documentation and everything worked fine. Except one thing - the self links of the users under /groups/:id/users were (as expected) using the route from the corresponding resource, for example:

https://server/groups/123/users/456

Instead, I'd like to have the "standard" location:

https://server/users/456

I tried to define a route option for the Users collection in the metadata map, but it was ignored. I examined the extractCollection() method in Plugin\HalLinks.php and it seems that metadata are taken into consideration only if the resource is embedded, but not if it is in the "first level" of the collection.

I may provide a solution, but I just wanted to ask, if I'm getting this right.

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