You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I set entity links within collection using $collection->setEntityLinks($LinkColection) these are not rendered.
Within Hal plugin exctractCollection() method if the $entity has metadataMap then its created from metadataMap inclusive links.
if (is_object($entity) && $metadataMap->has($entity)) { $entity = $this->getResourceFactory()->createEntityFromMetadata($entity, $metadataMap->get($entity)); }
After that there is only the call for rendering the $entity. if ($entity instanceof Entity) { // Depth does not increment at this level $collection[] = $this->renderEntity($entity, $this->getRenderCollections(), $depth, $maxDepth); continue; }
Probably there shall be a call to $entity->setLink($halCollection->getEntityLinks()) before the rendering.
I would propose following change . in the protected method of class Hal
`protected function extractCollection(Collection $halCollection, $depth = 0, $maxDepth = null)
{
...
if ($entity instanceof Entity) {
// inject entity links from the parrent Collection
if (!is_null($halCollection->getEntityLinks())) {
$entityLinks = $entity->getLinks();
foreach ($halCollection->getEntityLinks() as $collectionsEntityLink)
$entityLinks->idempotentAdd($collectionsEntityLink);
}
// Depth does not increment at this level
$collection[] = $this->renderEntity($entity, $this->getRenderCollections(), $depth, $maxDepth);
continue;
}`
If I set entity links within collection using $collection->setEntityLinks($LinkColection) these are not rendered.
Within Hal plugin exctractCollection() method if the $entity has metadataMap then its created from metadataMap inclusive links.
if (is_object($entity) && $metadataMap->has($entity)) { $entity = $this->getResourceFactory()->createEntityFromMetadata($entity, $metadataMap->get($entity)); }
After that there is only the call for rendering the $entity.
if ($entity instanceof Entity) { // Depth does not increment at this level $collection[] = $this->renderEntity($entity, $this->getRenderCollections(), $depth, $maxDepth); continue; }
Probably there shall be a call to $entity->setLink($halCollection->getEntityLinks()) before the rendering.
Originally posted by @vlx73 at zfcampus/zf-hal#175
The text was updated successfully, but these errors were encountered: