This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » DataType with more than 1 field ?...

DataType with more than 1 field ? howto ?

DataType with more than 1 field ? howto ?

Wednesday 30 November 2011 10:02:39 pm - 4 replies

Hi there, I would like to know how to create complex datatype with more than 1 field.

Until now, I used a simple data_text field with a separator (I simply explode the string in templates when I need it).

But now, I have long text to store with more complex formats.

So, I don't think that a single text field is a correct solution.

  • Is there a way to do it directly in eZ ?
  • Have I to create a table in the database to store my informations ?
  • Another solution ?



Wednesday 30 November 2011 10:29:13 pm

Hello Damien,


Consider storing your content within xml as it provides for greater storage opportunities here.

I would stick with xml storage unless you absolutely require something it can not easily provide. The best practice here is to avoid separate db tables as much as humanly possible.

Still ... I believe you can alternatively store at least part of your content related to the datatype within a persistant object (custom table).

See the nxc_string datatype for an implementation reference,


I hope this helps ....




Thursday 01 December 2011 3:38:33 am

Hello Damien,

I think you can also make use of the other (unused) related database table fields available for additional storage (mind the max lengths in play for each may be different).


This is what I would leverage to it's fullest before I gave out and move into a separate persistent object.
Still .. if your just looking like examples of other datatypes there are quite a few available to review, some more complete than others naturally.


You can always review the datatypes provided by default.
I think most store without separate tables as this is the best practice,
take a look at some of the more complex datatypes here and see just how far eZ takes this concept*


I saw this one today and though of your forum thread (seems to use xml and not separate tables, at least in part)


Then there are the datatypes published on (warning, not all are relevant or use separate tables)


Random threads found in research mode (it's cool, you don't have to follow them all, it's just for the record)

eZsurvey seems to use separate tables (you can see the reverse aspects the comments above of how in the following, they store in separate tables and have gone to lengths to do so),


eZstarrating seems to also use separate tables,


I really like this article on the subject of persistent object (better than the ezpedia stub),


... so damien, what kind of datatype are you thinking about making?


- "This sh** is eZ ..."
- "Hi how are you ..."
- "...zzzzzz..."
- "dead ... ghost buster"
- "that's why you ... that's why you ..."

Theme song: Birdman ft Nicki Minaj & Lil Wayne -- 'Y.U. MAD' ... ???


Modified on Thursday 01 December 2011 3:40:08 am by // kracker

Thursday 01 December 2011 9:13:23 am

... so damien, what kind of datatype are you thinking about making?

I would like to create an SEO datatype.

I have to store a lot of datas for all pages and maybe how to use those datas (with rules to apply on fields).

Thank you guys, I will read all those documentations and I'll give you feedbacks.


Saturday 03 December 2011 2:25:47 am

Hello Damien,


No worries. Happy to help.

I took a moment this evening to look through all the extensions on GitHub by eZ Systems. These are all extensions that eZ Systems chose to migrate to git and seem to be actively updated as well as well designed (better examples for reference?). I think if you wanted to look for ideas it could be better to get them from some of the very best works from eZ Systems.  

I think this list is of greater interest for review and study than the datatype hunt that compares. 

I found create table sql files in the following extensions. I think these use persistent objects / separate tables for storage at some level. Though you would still need to review them at some level to really get an idea if you can learn from their example.


Wow, I didn't think there would be so many (extensions with po use) when I started looking happy.gif Emoticon

I looked through almost all repositories of ezsystems on github to make this list so it should be fairly complete. Though it still is only a very ruff starting point from which to use to choose which extensions you review (perhaps for similar usage or use cases which apply to your requirements, needs and desires).


I look forward to hearing more about your advances towards increased storage potential actualized/realized for your SEO extension (it sounds cooler then the work I've been doing lately at least, XD have a great weekend!)


I hope this helps ... if not you today, then others in the distant future.





You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from