The content model for engineers
This page is for engineers who need to understand the content model as a data model before they design on top of it: what the entities are, which kernel class represents each, and what follows for queries, migrations and APIs. The editor's view of the same model is in The content model and editing content.
Contents
- The entities
- Runtime-defined schema
- Versions and translations
- The tree
- Datatypes
- Consequences for engineers
The entities
| Entity | Meaning | Kernel class |
|---|---|---|
| Content class | a type of content: name, identifier, attributes | eZContentClass |
| Class attribute | one field of a class, with a datatype and its settings | eZContentClassAttribute |
| Content object | one piece of content, an instance of a class | eZContentObject |
| Version | a state of an object: draft, published, archived | eZContentObjectVersion |
| Object attribute | the value of one class attribute in one version and one language | eZContentObjectAttribute |
| Node (location) | a place of an object in the content tree; one object can have several | eZContentObjectTreeNode |
| Datatype | storage, validation, editing and indexing of one kind of attribute | subclasses of eZDataType |
| Section | a partition of content used by permissions and designs | eZSection |
| Object state | a value from a state group, usable in permissions | eZContentObjectState |
Runtime-defined schema
Content classes are data, not code. Administrators add classes and attributes in the administration without a
deployment, and the tables do not change: attribute values live in generic columns of ezcontentobject_attribute,
interpreted by the datatype. Classes can also be shipped in packages (Packages).
That flexibility has a price: a query on a field value is a join through the attribute table, filtered by class attribute; use the fetch functions and their attribute filters rather than hand-written SQL.
Versions and translations
- Every edit creates a new version; publishing makes it the current version. Unpublished edits stay as drafts.
- The number of archived versions kept is limited per class by
content.ini [VersionManagement](DefaultVersionHistoryLimit,VersionHistoryClass[]);exp:cleanupversionsremoves old versions (read its--helpfirst: without it, it deletes). - Each object attribute exists per language. Which languages a siteaccess shows, and the fallback, are settings (Content languages, Content object fallback locale).
The tree
Nodes form one tree; every node has a parent, a path string and a depth. Node 2 is the root of the content tree in a default installation. Permissions with subtree limitations, URL aliases and most lists follow the tree, so its shape is part of your design. Moving or hiding a node changes the URLs and the visibility of everything below it.
Datatypes
A datatype is the extension point of the content model: one PHP class that stores, validates, edits, renders and
indexes one kind of attribute. Datatypes register in settings/content.ini [DataTypeSettings] AvailableDataTypes[];
an extension adds its own through ExtensionDirectories[]. A datatype must validate input in
validateObjectAttributeHTTPInput() and must not change the stored format of existing attributes without an update
script (Custom datatypes, Datatype lifecycle).
Consequences for engineers
| Concern | Consequence |
|---|---|
| Reads | use fetch functions (templates) or the content API (PHP); they apply permissions (The content API) |
| Writes | create and publish through the kernel so versions, caches, search and the audit trail stay consistent (Creating content in code) |
| Migrations of content structure | class changes are data changes; plan them with packages or scripts, not SQL |
| APIs | the REST API exposes objects, nodes and attributes with the same permission checks (API design) |
| Large operations | removes, copies and moves of big subtrees run as content jobs in the background (Content jobs) |
| Caches | a publish clears the view caches of the affected nodes through eZContentCacheManager (Cache invalidation and clearing) |
Related pages
- Persistence and the database layer
- Content functions from PHP
- eZContentObject reference
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.