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 » Storing objects in distinct tables

Storing objects in distinct tables

Storing objects in distinct tables

Wednesday 14 May 2003 1:23:16 pm - 4 replies

I was wondering whether there is a possibility to get content objects mapped to a specific database table. Basically, I want to base an interface to administrate the DB backend of our mailserver farm on ezpublish and content objects would be near ideal if I could map them into real tables. Is there any possibility to do something like that? Or would I have to implement my own module? (Which is damn near to implement it from scratch...).

Wednesday 14 May 2003 2:30:25 pm

Hello Gabriel,

If you have the time, I would suggest to make one or more new content datatypes which maps to your non-ez database table records for storage. It is not necessary to make a new module for that. Then you create a new class with your custom content datatype.

Instead of using ezpersistentobject for the attributes (fields) of your new dataype, you make your own database queries. Take a look at /kernel/classes/datatypes/ezimage. Here the storage is in the file system and a dedicated table, but you get the necessary structure and ideas.

Next you will want to write a script to create the object nodes from your table and keep them in sync.

That's the approach we will follow to integrate our own existing databases into ezpublish and getting the benefits of the rest of ezpublish.

It's a more complicated route (you will need to study how dataypes work) than an own module, but you may gain time in creating the user interface (ezp content objects, fetch function, ...).


Wednesday 14 May 2003 2:51:57 pm


If you have a single table with simple fields in the ezp database, you may also use ezpersistentobject (which basically needs a definition with table name, field names, ...) . Most of the rest is done for you.



Wednesday 14 May 2003 4:39:52 pm

Do you use postgresql? Or could you use it?
Why not try with DB stored procedures and triggers?
That's the path i will try to sync user data to your imap and smtp server.

It seems that svn version alrready has suport to pg 7.3 (i haven't tryed yet)

Thursday 15 May 2003 10:57:16 am

I thought about datatypes myself but they really are a pain to get right. Compared to that, writing a module is quite straightforward in any case. I mean I need to write some code no matter what (I definitely NEED sanity checking on something that just about handles all communication needs for hundreds of domains), it could even be better not to tie it to ezpublish in first place, I haven't made up my mind on that one (then again, if I don't tie it to ezpublish, I need at least some templating anyay).

Given that the permission model in ezpublish doesn't really make much sense for our use, I might be better off to just code a loosely related script that's able to run on its own, too.

Need to go look into eztemplate's license.

As using postgre and triggers: I might even go for Postgre (one of the guys here is STRONGLY biased against MySQL) but I'm not gonna allow any DB triggers messing around with my mailserver, especially as I can simply safe EVERYTHING (not sure about autoresponders yet, though) in the DB. The mailserver will create folder structures etc on its own anyway.

The only thing I can't control from the DB without triggers is, obviously, deleting of users but that's reasonably simple, too. Just set a delete flag and have a cronjob delete all files associated with an account.

Modified on Thursday 15 May 2003 11:01:49 am by Gabriel Ambuehl


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

36 542 Users on board!

Forums menu

Proudly Developed with from