Forums / Developer / Object relation types

Object relation types

Author Message

Kévin S.

Wednesday 07 July 2010 2:54:01 am

Hello everyone !

I have read the doc for all three types of relations (parent/children, common relations and attribute object_relation), and I need to know more about them : when to use a type of relation instead of another ?

Especially for attribute relations : in some tests, I've noticed that it doesn't provide full access to linked objects. In templates, I can only access 11 properties, such as "identifier", "priority", but not the data_map.

I don't understand the attribute relations if one can't reach the content of related objects from templates !

Any explaination would be very welcome.

Kévin

André R.

Wednesday 07 July 2010 8:28:24 am

That's probably beacuse it does not fetch the relations for you, just provide meta information about the relation.

Use fetch function to fetch them in the order you want for instance:

http://ez.no/doc/ez_publish/technical_manual/4_x/reference/modules/content/fetch_functions/related_objects

Pay attention to "all_relations":

 The "all_relations" parameter makes it possible to fetch all types of relations (when set to TRUE).
This parameter is not required and the default value is FALSE.
In addition, the value of this parameter can also be an array.
The array may consist of the following strings: "common", "xml_link", "xml_embed" and "attribute"

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

Kévin S.

Wednesday 07 July 2010 9:04:45 am

Oh, OK thank you !

Could you give an example of use of each relation (attribute, children and common) ?

I can't choose between them, they all seem to be technically the same...