PHP ORM:教义与推进 [英] PHP ORMs: Doctrine vs. Propel

查看:14
本文介绍了PHP ORM:教义与推进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 symfony 开始一个新项目,它很容易与 学说推进a>,但我当然需要做出选择......我想知道如果有更多有经验的人选择这两者中的任何一个,是否有一般的优点和/或缺点?

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.

推荐答案

我会选择 Doctrine.在我看来,它是一个更加活跃的项目,并且作为 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/introduction:doctrine-explained

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 和 Propel 之间做出选择,我随时都会选择 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 ORM:教义与推进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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