PHP ORMs:Doctrine vs. Propel [英] PHP ORMs: Doctrine vs. Propel

查看:115
本文介绍了PHP ORMs:Doctrine vs. Propel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 symfony 开始一个新项目,该项目与原则推荐,但我当然需要做出选择....我想知道如果有更多的经验丰富的人有这些两个中的任何一方的一般利弊?

I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two?

非常感谢。

编辑:
感谢所有的回复,有用的东西。这个问题没有真正正确的答案,所以我只会把它列为获得最受欢迎的最多票的人。

Thanks for the all the responses, useful stuff. There's no truly correct answer to this question so I'll just mark as approved the one that got the most popular up-votes.

推荐答案

我会与教义一起去。在我看来,这是一个更加活跃的项目,并且作为symfony的默认ORM,它被更好的支持(即使官方的ORM被认为是相等的)。

I'd go with Doctrine. It seems to me that it is a much more active project and being the default ORM for symfony it is better supported (even though officially the ORMs are considered equal).

此外我更喜欢你使用查询的方式(DQL而不是Criteria):

Furthermore I better like the way you work with queries (DQL instead of Criteria):

<?php
// Propel
$c = new Criteria();
$c->add(ExamplePeer::ID, 20);
$items = ExamplePeer::doSelectJoinFoobar($c);

// Doctrine
$items = Doctrine_Query::create()
       ->from('Example e')
       ->leftJoin('e.Foobar')
       ->where('e.id = ?', 20)
       ->execute();
?>

(Doctrine的实现对我来说更加直观)。

(Doctrine's implementation is much more intuitive to me).

此外,我更喜欢在Doctrine中管理关系的方式。

Also, I really prefer the way you manage relations in Doctrine.

我认为这个从Doctrine文档中的这个页面值得一读: http://www.doctrine-project.org/documentation/manual/1_2 / en /介绍:教义解释

I think this page from the Doctrine documentation is worth a read: http://www.doctrine-project.org/documentation/manual/1_2/en/introduction:doctrine-explained

总结:如果我开始一个新项目,或者必须在学习教义和推进之间选择我会任何一天去Doctrine。

To sum up: If I were starting a new project or had to choose between learning Doctrine and Propel I'd go for Doctrine any day.

这篇关于PHP ORMs:Doctrine vs. Propel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆