PHP ORMs: Doctrine vs. Propel(PHP ORM:Doctrine vs. Propel)
问题描述
我正在使用 symfony 开始一个新项目,它很容易与 Doctrine 和 推进a>,但我当然需要做出选择....
非常感谢.
感谢所有回复,有用的东西.这个问题没有真正正确的答案,所以我只会将获得最多票数的答案标记为已批准.
我会选择 Doctrine.在我看来,这是一个更加活跃的项目,并且作为 symfony 的默认 ORM,它得到了更好的支持(尽管官方认为 ORM 是平等的).
此外,我更喜欢您使用查询的方式(DQL 而不是 Criteria):
add(ExamplePeer::ID, 20);$items = ExamplePeer::doSelectJoinFoobar($c);//教义$items = Doctrine_Query::create()->from('示例 e')->leftJoin('e.Foobar')->where('e.id = ?', 20)->执行();?>(Doctrine 的实现对我来说更直观).
另外,我真的更喜欢你在 Doctrine 中管理关系的方式.
我认为 Doctrine 文档中的这一页值得一读:http://www.doctrine-project.org/documentation/manual/1_2/en/introduction:doctrine-explained
总结一下:如果我要开始一个新项目,或者必须在学习 Doctrine 和 Propel 之间做出选择,我会随时选择 Doctrine.
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 a lot.
EDIT: 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.
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).
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's implementation is much more intuitive to me).
Also, I really prefer the way you manage relations in Doctrine.
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
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:Doctrine vs. Propel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP ORM:Doctrine vs. Propel
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Laravel 仓库 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
