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

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

Open
weierophinney opened this issue Dec 31, 2019 · 1 comment

Comments

@weierophinney
Copy link
Contributor

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.


Originally posted by @vorgas at zfcampus/zf-hal#166

@weierophinney
Copy link
Contributor Author

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


Originally posted by @Wilt at zfcampus/zf-hal#166 (comment)

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