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

In eZ Publish 3.8 and earlier versions, the relations at the object level were generic and could not be grouped in any way. From 3.9, there are three types of relations at the object level:

  •  Common
  •  XML linked
  •  XML embedded

Common

A relation of the "common" type is created when a user manually adds a content object to the related object list of another object. (In most cases, this is done by using the "Related objects" window in the object edit interface.) This method is always available for use.

XML linked

Whenever an internal link (a link to other node or object) is inserted into an attribute represented by the "XML block" datatype, the system will automatically create a relation of the "XML linked" type. Note that a relation of this type is automatically removed from the system when the corresponding "link" tag is removed from the content.

XML embedded

Whenever an "embed" tag is inserted into an attribute of the "XML block" datatype, the system will automatically create a relation of the "XML embedded" type, i.e. relate the embedded object to the one that is being edited. Note that a relation of this type is automatically removed from the system when the corresponding "embed" tag is removed.

Relations at the attribute level

Relations of this type will be automatically generated whenever the "Object relation" or the "Object relations" datatypes are used. While the first one allows only a single relation, the second allows multiple relations. 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 custom structure with grouped relations.

Please note that these datatypes take care of object relations only, and don't consider any particular existing permissions or visibility states. If you intend to filter relations considering existing roles and permissions we recommend the use of fetch functions within view templates. This way permissions and visibility will be considered.

Balazs Halasy (14/09/2010 10:56 am)

Ricardo Correia (14/05/2013 10:21 am)

Geir Arne Waaler, Ricardo Correia


Comments

There are no comments.