Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use Doctrine over Zend_Db?

I use Zend_Db in some project, I discover Doctrine there is a while but never actually used it.

What are the advantage of Doctrine over Zend_Db ? What are the benefits to use Doctrine ?

By the way, is it easy to use Doctrine with Zend Framework 1.10.7? Integration and use with the other component ? As it doesn't seem to exist a Doctrine Adapter

Thank you

like image 877
John Avatar asked Aug 14 '10 11:08

John


1 Answers

Doctrine is an ORM. It's meant for persisting a rich domain object model to a database and allow querying effectively while maintaining the results as objects. Zend_Db comprises an implementation of the table and row data gateway design patterns, which provide a simple scheme for querying a single table and manipulating its rows. That makes Zend_Db a kind of a lesser cousin of Doctrine, with the latter vastly more powerful and useful while also more complex and resource intensive. If you have a rich domain model with a lot of interrelations, Doctrine is your solution to managing all the complexity. For simple CRUD on simple tables, by all means go for Zend_Db.

You don't need an adapter for Doctrine, you just use it. Several classes in Zend Framework integrate readily with Zend_Db, though - such as validation based on database row existence - and you'll have to cook up your own equivalents. It will take some work but it's not a complex task, and you may be able to find some implementations readily available on the net.

like image 159
Ezku Avatar answered Oct 21 '22 20:10

Ezku