-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Different output from onRenderEntity and onRenderCollection when adding additional Entities in Events #21
Comments
Desired behaviour from my point of view would be: renderEntity and renderCollection.entity have same behaviour and event params Currently renderEntity event:
Set links/embedded entities are NOT rendered in HAL response due to described behaviour in description of this issue. renderCollection.entity :
Set links/embedded entities are rendered in HAL response. Desired Make both events consistent in terms of params and behaviour. This would avoid confusion and remove unnecessary code e.g. https://gist.github.com/matuszeman/b797d9c70a4ce9e0974a#file-gistfile1-php-L27 renderEntity event:
Set links/embedded entities on 'entity' are rendered in HAL response. renderCollection.entity :
Set links/embedded entities on 'entity' are rendered in HAL response. Additional ideas HalEntity holds extracted array of domain entity only and domain entity identifier e.g. class name or entity itself (not used for further modification of an result though). renderEntity event:
renderCollection.entity :
Originally posted by @matuszeman at zfcampus/zf-hal#53 (comment) |
@matuszeman Actually, your suggestion to unify the parameters for the events is not really possible. The reason Regarding the original issue posted by @Alanin however: the problem is that we're keying the Originally posted by @weierophinney at zfcampus/zf-hal#53 (comment) |
Okay, interesting: we're using an Originally posted by @weierophinney at zfcampus/zf-hal#53 (comment) |
@Alanin Can you please provide a unit test for this? Based on your writeup, I'm unable to build a failing unit test at this point. Originally posted by @weierophinney at zfcampus/zf-hal#53 (comment) |
As stated by Matus Zeman @matuszeman here https://groups.google.com/a/zend.com/forum/#!topic/apigility-users/zck43pReklw there seems to be a bug in the Hal helper when rendering single entities.
Quoted from the google group:
"I believe there is a bug in Hal helper (https://github.com/zfcampus/zf-hal/blob/master/src/Plugin/Hal.php#L1140) where convertEntityToArray() method caches converted entities so when you set new entities or links into entity using 'renderEntity' event convertEntityToArray() returns original entity anyway ignoring everything - https://github.com/zfcampus/zf-hal/blob/master/src/Plugin/Hal.php#L495"
Code for single Entity (http://192.168.33.101/events/2182)
Dump of $halEntity
Output - embedded entity is missing
Code for Collection (http://192.168.33.101/events)
Dump of $halEntity
Output - with embedded entity
Originally posted by @Alanin at zfcampus/zf-hal#53
The text was updated successfully, but these errors were encountered: