Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Object relations

The content model of eZ publish makes it possible to create relations between different objects. Any type of object can be connected to any other type of object. This feature is typically useful in situations when there is a need to bind and/or reuse information that is scattered around in the system.

For example, the concept of related objects makes it possible to add images to news articles. Instead of using a fixed set of image attributes, the images are stored as separate objects outside the article. These objects can then be related to the article and used directly in attributes represented by the "XML block" datatype. This approach is quite flexible because it does not enforce any limitations when it comes to the amount and the type of information that is to be included.

Relation types

A relation between two objects can be created either at the object level or at the object attribute level. The system stores the different types of relations using the same database table. An object can not have a relation to itself.

Relations at the object level

This method is completely generic and it is always available for use. It allows the users to add objects to an object's related object array. This array is available for all objects; it is nothing more than a collection of the related objects' ID numbers. In other words, the relations can not be grouped in any way.

Relations at the attribute level

This method can be achieved using either the "Object relation" or the "Object relations" datatypes. While the first one allows only a single relation, the second allows multiple relations. Again, there is no grouping of the relations. However, by making use of several attributes that are represented by one of these datatypes, it is possible to create a structure with grouped relations.

Balazs Halasy (24/10/2005 11:38 am)

Balazs Halasy (24/10/2005 11:52 am)


Comments

  • Please elaborate on the distinct types of relations

    The distinction between object relations and attribute relations is not very clear. Why would one want to differentiate between object or attribute relations. Furthermore, by providing two implementations for attribute relations imply a difference, however this cannot be understood from the explanation.

    Two examples, one differentiating between object & attribute relations and the other between the two attribute relation implementations, would certainly enlight the subject to the reader.

    Thanks in advance.
  • I agreed, please specify

    Wonderful tutorial! Thanks..