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

eZ debug

Timing: Jan 18 2025 14:51:36
Script start
Timing: Jan 18 2025 14:51:36
Module start 'content'
Timing: Jan 18 2025 14:51:36
Module end 'content'
Timing: Jan 18 2025 14:51:36
Script end

Main resources:

Total runtime0.0188 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 587.7109180.8359
Module start 'content' 0.00860.0061 768.546993.8672
Module end 'content' 0.01470.0040 862.414170.7031
Script end 0.0187  933.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002412.8600120.0002
Check MTime0.00116.0778120.0001
Mysql Total
Database connection0.00147.377410.0014
Mysqli_queries0.004122.062340.0010
Looping result0.00000.106620.0000
Template Total0.003619.110.0036
Template load0.00095.052410.0009
Template processing0.002614.026310.0026
Override
Cache load0.00073.608110.0007
General
dbfile0.00052.4799100.0000
String conversion0.00000.030530.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs