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
基础教程推荐
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01