This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!
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.
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:
- XML linked
- XML embedded
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.
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.
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 (24/10/2005 1:38 pm)
Ricardo Correia (14/05/2013 12:24 pm)