eZ Community » Learn » eZ Publish » Creating Datatypes in eZ Publish 4

Creating Datatypes in eZ Publish 4

Wednesday 21 May 2008 6:14:00 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Content in eZ Publish is stored in attributes of content objects. A datatype describes the type of value that can be stored in an attribute and is the smallest possible entity of storage. It determines how a specific type of information should be validated, stored and retrieved. eZ Publish comes with a set of datatypes for, among other things, plain text, formatted text, images, email addresses and dates. This article explains how to create additional datatypes in eZ Publish 4, and explores how to take advantage of some of the new eZ Publish 4 features.

eZ Publish 4, which was released in November 2007, is the first eZ Publish version that runs on PHP 5. In addition, it uses the eZ Components framework. This gives extension developers a broad range of new features and possibilities, including exceptions, visibility modifiers, class constants, static class variables, magic getter and setter methods, the DateTime extension, class autoloading and de-referencing object return values.

 In this article, we will create an extension for a new datatype to save PHP DateTime objects. We will outline the general requirements for creating datatypes and also give special attention to exceptions and the UserInput component.

Download the extension

 The example extension from this article can be checked out via SVN at http://github.com/ymc/ymc-ezp-datatypes.

36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from