开发者

Zend Model Best Practices - Doctrine?

开发者 https://www.devze.com 2023-03-29 19:43 出处:网络
I\'ve been readi开发者_开发知识库ng 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 s

I've been readi开发者_开发知识库ng 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!


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:

  • guilhermeblanco / ZendFramework1-Doctrine2

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

0

精彩评论

暂无评论...
验证码 换一张
取 消