Storing objects in distinct tables

Author Message

Gabriel Ambuehl

Wednesday 14 May 2003 4:23:16 am

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...).

Visit http://triligon.org

Paul Borgermans

Wednesday 14 May 2003 5:30:25 am

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, ...).

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Wednesday 14 May 2003 5:51:57 am

More:

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.

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paulo Almeida

Wednesday 14 May 2003 7:39:52 am

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)

PACPI.COM Internet Consulting
http://pacpi.com

Gabriel Ambuehl

Thursday 15 May 2003 1: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.

Visit http://triligon.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.