Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

The content model for ORM users

Content classes, objects, versions, translations, nodes, datatypes, sections and object states explained in the terms of an ORM - what each is in the database and in PHP, how a typical blog or catalog maps onto it, and…

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/web-framework-developers/the-content-model-for-orm-users.md

On this page

The content model for ORM users

This page is for developers who would start a project by writing entity classes and migrations. In Exponential, most data that editors manage is content: you define its types in the administration (or ship them as packages), and the kernel stores, versions, translates, permits, caches and indexes it. Your code reads and writes content through the content API instead of a model class of its own.

Contents

  1. The pieces in ORM terms
  2. Datatypes
  3. Versions and translations
  4. Nodes: one object, several places
  5. Sections, states and relations
  6. A blog, mapped
  7. Reading and writing from code

The pieces in ORM terms

ExponentialClosest ORM ideaClass
Content class (Article: Title, Intro, Body, Image)an entity or model definitioneZContentClass
Class attributea field definition with its type and settingseZContentClassAttribute
Content objectone row of the entity, with its historyeZContentObject
Versiona revision of the row: draft, published, archived and moreeZContentObjectVersion
Object attributeone field's value, per version and languageeZContentObjectAttribute
Node (location)where the row appears in the site tree; parent and childreneZContentObjectTreeNode
Remote IDa stable external key you choose, unlike the numeric idremote_id of objects and nodes

The administrator's view of the same terms: The content model and editing content.

Datatypes

Each class attribute has a datatype, which is a column type, a form widget, a validator and a renderer in one: ezstring (one line), eztext, ezxmltext (rich text), ezinteger, ezfloat, ezboolean, ezdate, ezdatetime, ezemail, ezurl, ezimage, ezbinaryfile, ezobjectrelationlist, ezselection, ezmatrix, ezuser and more (the shipped ones are in kernel/classes/datatypes/). The ones offered for new attributes are content.ini [DataTypeSettings] AvailableDataTypes[]. A new kind of field is a datatype class extending eZDataType in your extension (Custom datatypes).

Versions and translations

  • Every edit creates a version; publishing makes it current and archives the previous one. Drafts are versions with their own status (eZContentObjectVersion::STATUS_DRAFT, STATUS_PUBLISHED, STATUS_ARCHIVED and others).
  • Each version holds the attribute values for each language it is translated into. Which language a siteaccess shows follows its SiteLanguageList (Content languages).
  • History, compare and restore come with it; you write none of it.

Nodes: one object, several places

An object is placed in the tree by nodes. One object can have several nodes (the same article in "News" and in "Sport"); one is its main node. The tree gives you navigation, URL aliases, subtree permissions and subtree queries (path_string, depth). There is no separate "category" table to design unless you want one.

Sections, states and relations

FeatureUseRead
Sectiona group of content for permissions and design (Standard, Users, Media...)Sections
Object statea workflow-like status per object (for example "locked", "in review") usable in policies and request rulesObject states
Object relationa link from one object to others, kept with reverse lookupsThe content API

A blog, mapped

Framework approachExponential approach
posts table, Post model, migrationclass blog_post (title, intro, body, image, tags) created in Setup > Classes or installed from a package
categories table, foreign keyfolders in the tree, or a relation attribute, or tags from eztags
post_revisions tableversions, built in
post_translations tabletranslations, built in
slug column, unique indexURL alias, built in (Pretty URLs)
Admin CRUD screensthe administration, built in
Policy class per modelroles with content/read, content/edit limited by class, section, subtree (Authorization)
Controller and templates for the front endoverride templates for the class's full and line views (Template resolution)

Reading and writing from code

$node   = eZContentObjectTreeNode::fetchByURLPath( 'about_us' );
$object = eZContentObject::fetchByRemoteID( 'expdemo-settings-page' );
$title  = $object->dataMap()['title']->content();

$article = eZContentFunctions::createAndPublishObject( array(
    'creator_id'       => $userID,
    'class_identifier' => 'article',
    'parent_node_id'   => $parentNodeID,
    'remote_id'        => 'feed-item-' . $externalID,
    'attributes'       => array( 'title' => 'A new article' ) ) );

Rules:

  • Write content only through the content API (eZContentFunctions, operations), never with SQL on the content tables: publishing runs workflows, clears caches and updates the search index.
  • Prefer remote IDs for content your code depends on; numeric IDs differ between installations.
  • Set a Limit on every list fetch.

Full reference: The content API in PHP and Creating and updating content in code.

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.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x