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.

Datatypes

A datatype is the smallest possible entity of storage. It determines how a specific type of information should be validated, stored, retrieved, formatted and so on. eZ publish comes with a collection of fundamental datatypes that can be used to build powerful and complex content structures. In addition, it is possible to extend the system by creating custom datatypes for special needs. Custom datatypes have to be programmed in PHP. However, the built in datatypes are usually sufficient enough for typical scenarios. The following table gives an overview of the most basic datatypes that come with eZ publish.

Datatype

Description

Text line

Stores a single line of unformatted text

Text block

Stores multiple lines of unformatted text

XML block

Validates and stores multiple lines of formatted text

Integer

Validates and stores a numerical integer value

Float

Validates and stores a numerical floating point value

Please refer to the "Datatypes" section of the reference chapter for a comprehensive list of all the built-in datatypes. Additional datatypes can be downloaded from http://ez.no/community/contribs/datatypes; they are created by the members of the eZ publish community.

Input validation

As the list above indicates, some datatypes take care of more than just storing data. For example, the "XML block" datatype apparently supports validation. This means that the inputted XML will be validated before it is actually stored in the database. In other words, the system will only accept and store the data if it is a valid XML structure. Input validation is supported by most (but not all) of the built in datatypes. The validation feature of a datatype can not be turned on or off. In other words, if a datatype happens to support validation, it will always try to validate the incoming data and thus the system will never allow the storage of incorrectly formatted input.

Balazs Halasy (20/01/2005 3:04 pm)

Svitlana Shatokhina (31/08/2006 8:30 am)

Balazs Halasy, Svitlana Shatokhina


Comments

  • Is it possible to change datatypes after class creation?

    If I've created a datatype as a "textline" and I realized that it should have been an "integer," can I change it? The only way to change a datatype in the interface is to delete and recreate it, which involves losing all the data.

    I'm guessing that you can't because some of the datatypes are complex and the data stored in them just wouldn't transfer to another type. Additionally, I know that the database has different columns for integers and strings and such.

    Can I an confirmation that this is not possible?
    • Re: Is it possible to change datatypes after class creation?

      Unfortunately it is not possible (yet :-).

      Allman
  • option

    How can we create the differents items of an attribute "option" ?