SidC
SidC

Reputation: 3203

Zend Model Best Practices - Doctrine?

I've been reading a lot today about Doctrine2 usage in ZF projects and have seen many examples using it and Zend_DB. Is thee a suggested approach for use in a medium sized database schema 5-7 tables with relationships? Is Doctrinr better at managing foreign key relationships? Should Zend_DB used for this size project as Doctrine would be overkill?

Looking for a clear decision tree as to whether Doctribe would be the way to go. Thanks for your help!

Upvotes: 0

Views: 477

Answers (1)

Layke
Layke

Reputation: 53126

Doctrine is just about getting things up and running as soon as possible.

The problem with Zend_Db is that it isn't an ORM, nor does it try to be an Object Relational Mapper, which means that if you do intend to use Models, then you have to create all of these yourself and do all of the hard work.

Personally, I would say that a project of this size is an ideal opportunity for you to learn how to use Doctrine. Like Zend Framework, Doctrine does come with a learning curve, you won't be able to pick it up and immediately start, but if you read the documentation back to cover, you will understand how it can help you in the future to rapidly develop applications, with complex queries, that require practically zero thought.

It can sometimes be challenging, using Zend_Db_Table to create your queries that do joins, and use Zend_Db_Expr. However, with Doctrine, you can generate your models automatically through YAML or by just creating the properties and annotating them (like you would with DocBlock).

Zend Framework and Doctrine 2 Integration:

If it helps influence you at all, I never intend on using Zend_DB_Table again. Ever.

Upvotes: 2

Related Questions