eZ Community » Forums » Setup & design » reverse_related_object does not get...
expandshrink

reverse_related_object does not get all objects

reverse_related_object does not get all objects

Thursday 02 May 2013 5:26:57 pm - 2 replies

Hi everyone,

Here's my problem : I'm trying to get the reverse related object of an object, and I fail at doing this !

My node "Node_A" got two Reverse Related Objects : "RNode_1" (Relation type = Link) and "RNode_2" (Relation type = Attribute (Class of RNode_2)).

Of course, the RNode_2 is a node having "Node_A" in Related Object attribute.

When I fetch on the Node_A,  , using reverse_related_object like this :

        {def $reverseRelatedObjects = fetch('content', 'reverse_related_objects', hash(
            'object_id', $Node_A.object_id            ))        }

the only result i get is RNode_1. Is that due to the Relation Type ? Or am I missing something else ?

Thank you !

Modified on Thursday 02 May 2013 5:30:15 pm by Math Del

Thursday 02 May 2013 7:05:17 pm

I think you have to pass the 'all_relations' parameter

Try to see http://doc.ez.no/eZ-Publish/Techn...reverse_related_objects#comment21116

Friday 03 May 2013 9:16:22 am

Thank you for answer, but i found how to fix it ! Here's how, if it can be useful for someone else

The attribute_identifier was missing, and must specify the identifier of the Relation Type :

{def $reverseRelatedObjects = fetch('content', 'reverse_related_objects', hash(
            'object_id', $Node_A.object_id,
            'attribute_identifier', '[RNode_2.classname]/[attribute_identifier]          ))        }

 

where "attribute_identifier" = name of the attribute of "(Relation type = Attribute (Class of RNode_2))" in my previous post.

Modified on Friday 03 May 2013 9:16:42 am by Math Del

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from