Cover image for post Object relation mapping in eZ Components

Object relation mapping in eZ Components

I wrote an article, that introduces the relation featuresw of our ORM compoenent "PersistentObject" to you, using a practical example application. For me the coolest feature of PersistentObject is, that the component does not require you're ORM enabled classes to inherit from a certain base to allow your objects to be stored in a database (made persistent). PersistentObject simply allows you to configure any of your applications objects to be persistent and you keep a nice an clean OO structure. If you are interessted in learning more, just follow my trip into PersistentObject on ez.no.

Comments

Hi,

I'm just a bit curious. You write: "For me the coolest feature of PersistentObject is, that the component does not require you're ORM enabled classes to inherit from a certain base to allow your objects to be stored in a database" but i the article I read "The PersistentObject component does not require you to inherit from a specific base class, nor to stick to a given naming scheme. The only requirement is to implement two methods in the object class" except the fact tat I'd prefer having an interface for such two methods I can see a inconsistence between thees two statements...

Johannes at 2007-02-28

Hi Johannes!

"I can see a inconsistence between thees two statements". I don't see it. We do not require people to extend a certain baseclass (that's what I wrote), but we require them to implement 2 methods in their persistent object classes. That's a huge difference:

For example if you have a class "A3Sportsback", which extneds "A3", which extends "Audi", which extends "Car". Now you want to store objects of "A3Sportsback" into a database, we do not require you to a) change your inheritence and make "A3Sportsback" directly from our common base class or b) make you inherit your most bottom base class ("Car") from this one. Instead, you can simply implement the named 2 methods in "A3Sportsback" and are done and your inheritence scheme stays nice and clean.

We do not require an interface for setState() and getState(), because we will most propably create a technique in the future, where you can define the methods/properties/whatever that are accessed by PersistentObject on your own.

Hope that clearifies it?

Thanks for your comment! Regards, Toby

Toby at 2007-02-28