Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Entity identifier other than 'id' does not generate self link in collection #166

Open
vorgas opened this issue Apr 4, 2017 · 2 comments

Comments

@vorgas
Copy link

vorgas commented Apr 4, 2017

If I set 'entity_identifier_name' => 'code' then the links to the entities are not generated when fetching the collection. The link is generated when fetching an entity only.

Following the code at https://groups.google.com/a/zend.com/forum/#!msg/apigility-users/p4BWDl9oiIM/YnitOfkEAfUJ will now provide an entry for all properties in the entity. Obviously not a good response since these properties are not set when fetching a collection.

I have tried poking around in the code, and in
ZF\Hal\Plugin\Hal::setEventManager() it seems to be hardcoded looking for 'id' (lines 168/169). If I hack this to 'code' then it populates just fine.

In the meantime, I have hooked into the 'getIdFromEntity' listener and made an ugly hack to try to extract this key.

@Wilt
Copy link
Contributor

Wilt commented Jun 13, 2017

I agree that this should be possible. We also had to make a workaround.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-hal; a new issue has been opened at laminas-api-tools/api-tools-hal#5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants