PHP ORMs: Doctrine vs. Propel(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:教义与推进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP ORM:教义与推进
基础教程推荐
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01