开发者

Doctrine ORM in CodeIgniter - pros and cons?

I'm looking into Doctrine as my ORM for an upcoming CodeIgniter project. I've never used an ORM before, but based on what I have read so far, it's a great thing. So, I'd like to get my hands in it.

Questions:

  1. In your experience, what are the benefits of Doctrine?
  2. I noticed that I can identify certain tables to include created_at and updated_at columns. How beneficial is it to know when a record was created and last updated? Should I do this for开发者_StackOverflow中文版 all my tables?

Thanks.


I haven't personally used Doctrine, but have been told it works well. My understanding is that it requires a significant amount of setup, and works magically after that.

The ORM I typically use with CodeIgniter is called DataMapper ORM, which is a native CodeIgniter solution. Installation is simple (copying a couple files), setting up models is stupidly easy, the tables are simple, and it uses the existing application's database settings. For all the magic without the setup, I'd recommend DataMapper.

Regarding the use of created_at and updated_at columns, only add those columns when you need to track that anyway, such as a blog post or a system user. Specifying those columns lets the ORM handle those fields, so you don't need to, so whenever you create or update objects created from the database, those fields are updated automatically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜