eZ Community » Forums » General » reverse_related_objects...
expandshrink

reverse_related_objects attribute_identifier array instead single ID

reverse_related_objects attribute_identifier array instead single ID

Tuesday 22 July 2014 4:09:44 pm - 1 reply

Hi to all,

is it possible to make a reverse_related_objects fetch using more than one attribute_identifier?

EXAMPLE:

I have this one

{def $related=fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'attribute_identifier', '361'  ) )}

and I want to fetch all relation also for attribute_identifier id 438.

I as thinking something about

{def $related=fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'attribute_identifier', array('361','438')  ) )}

but it doesn't work.

Any ideas?

Thanks
Luca 

Sunday 17 August 2014 12:17:30 pm

Hello,

Sorry I can't answer your question directly but ... I do have a suggestion.

Why not avoid this problem in the short term by doing more than one fetch and simply appending the results of the second fetch into the array returned by the first fetch.

https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Arrays/append

This is an untested source code snippet example but should give you an idea on how to work with this concept:

{def $related=fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'attribute_identifier', '361'  ) )}
 
{foreach fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'attribute_identifier', '438'  ) ) as $relatedOne}
{set $related=$related|append( $relatedOne )}
{/foreach}
 
{$related|attribute(show,2)}

I hope this helps!

Cheers,
Heath

Modified on Sunday 17 August 2014 12:24:34 pm by // Heath

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from