Hi Allard,
I'm using Zend Framework together with Smarty and Propel, that's a very
useful combo. I think it's a kind of overkill to write such a complex
thing like an ORM in this time. I also worked on an ORM in times, Zend
Framework didn't exist and Propel was a kind of buggy, but I stopped
working on that because of a disrelation of performance and handling.
There is to do much more than simply putting rows in objects -
especially, when you're working on complex db-design.
Regards,
Matthias
Allard Buijze schrieb:
Hi all,
I've been using the Zend_Db component for a while, but I am missing
one little, though important, thing: Object Relational Mapping (i.e.
how do you map a database row into an object).
I strongly beleive this should not be the responsability of the model
objects. Since they're passed around by the controller to the view,
they should be as plain and stupid as possible. You wouldn't want the
view to knowingly access the database.
I think the Zend_Db is missing some sort of OR Mapper that allows the
creation of these Simple Objects (or even better, a proxy object that
targets it). I've created a small prototype (it works, but the code is
extremely ugly) of a "DB Manager" that uses XML configuration files
that describe how the Simple Objects (usually domain/model objects)
are mapped from and to the database. I've even added a lazy
initialization feature, which is useful for large BLOB values or 1 to
many relationships.
Small usage example:
$db_Manager = new Db_Manager($zend_db_adapter);
$my_domain_object = $db_Manager->load("My_Domain_Object", $my_id);
(load fetches an object of the given class and given ID from the database)
Does such ORM component deserve a place in the Zend Framework and are
there any people that would like to create it with me? Please let me know.
Regards,
Allard Buijze
PS. Some ideas of the ORM and the XML configuration are borrowed from
Hibernate. Check www.hibernate.org <http://www.hibernate.org>