Forums / Developer / Multiple related objects

Multiple related objects

Author Message

Dev Trimaran

Tuesday 09 June 2009 7:50:05 am

Hi ,
I have use the field related objects to rely a object to multiples objects.
Then I try to fecth all the related object.
So I use the fecth function with 'related_objects' like this :
{def $links = fetch( 'content', 'reverse_related_objects', hash( 'object_id', $keyword.node_id ))}
{def $links2 = fetch( 'content', 'related_objects', hash( 'object_id', $keyword.node_id ))}

I tryed related and reverse_related ....

But it did not work.
Is it because its' a multiples related object ?

Plus , I can see in the back office the related objects , so I guess there is a way to do it....

Thanks for your help ...

André R.

Tuesday 09 June 2009 8:48:48 am

You'll need to use the object id of the keyword node, not the node id.
It's most likely $keyword.contentobject_id you'll want to use.

Node vs object reference:
http://ez.no/doc/ez_publish/technical_manual/4_0/concepts_and_basics/content_management/the_content_node
http://ez.no/doc/ez_publish/technical_manual/4_0/concepts_and_basics/content_management/the_content_node_tree

Node attributes:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/objects/ezcontentobjecttreenode

I guess you have looked at it, but place a link to the related_objects fetch doc page here anyway:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/related_objects

And while on it, the different type of relations in ezp:
http://ez.no/doc/ez_publish/technical_manual/4_0/concepts_and_basics/content_management/object_relations

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom