Allard Buijze wrote:
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>


I am also very interested in this issue, but I haven't used ZF since I tried using Zend Lucene a while back. Nonetheless I will be watching this thread.

I took a look at hibernate, and would also like to look at the much hyped Rails framework, hopefully come up with a design for a good ORM solution. It would be great if we could implement this in the ZF



Haddad

Reply via email to