有什么类似于 PHP 中的 Hibernate 的吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2605074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Anything similar to Hibernate in PHP?
提问by gmhk
I am a Java programmer and was working on a project using Hibernate and Struts for some time.
我是一名 Java 程序员,并且在使用 Hibernate 和 Struts 的项目上工作了一段时间。
Now For my new project, I am working on PHP and Mysql (learning PHP). Is there any technology which is similar to Hibernate for PHP? If yes, can anyone give me the link where I can understand and use it?
现在对于我的新项目,我正在研究 PHP 和 Mysql(学习 PHP)。有没有类似于 Hibernate for PHP 的技术?如果是的话,谁能给我一个我可以理解和使用它的链接?
Is there a POJO concept in PHP?
PHP 中有 POJO 概念吗?
采纳答案by JAL
In my opinion the best ORM for PHP is Doctrine.
在我看来,PHP 最好的 ORM 是Doctrine。
You may also wish to check out Propeland see which suits your style better.
您可能还希望查看Propel,看看哪种更适合您的风格。
PHP ORMs: Doctrine vs. Propelis a recent SO question comparing the two. Common PHP frameworks like Symfony let you use either ORM as far as I recall.
PHP ORMs: Doctrine vs. Propel是最近比较两者的一个 SO 问题。据我所知,像 Symfony 这样的常见 PHP 框架允许您使用 ORM。
As far as POJOs, as far as I know you'd use stdClass for that in PHP. I'm not much with Java though, so I can't say for sure. Here's an SO Question about that... What is stdClass in PHP?
至于 POJO,据我所知,你会在 PHP 中使用 stdClass。不过我对 Java 不太了解,所以我不能肯定地说。这是一个关于那个的问题...... PHP 中的 stdClass 是什么?
回答by DVK
If you're not stuck on PHP (e.g. you can use any scripting language), Perlhas both POJO concept (Perl objects) and Hibernate alternatives (including hibernate Perl port; and several Object-Relational Mapping classes).
如果您不拘泥于 PHP(例如,您可以使用任何脚本语言),Perl既有 POJO 概念(Perl 对象),也有 Hibernate 替代方案(包括hibernate Perl 端口;和几个对象关系映射类)。
If you're forced into PHP, you can see alist of OR/M for PHP here
如果您被迫使用 PHP,则可以在此处查看 PHP 的 OR/M 列表
回答by Flavien Volken
There is also dmz as a doctrine alternative: http://datamapper.wanwizard.eu/which is very simple to setup and made to work with codeigniter.
还有 dmz 作为教义替代方案:http: //datamapper.wanwizard.eu/设置起来非常简单,并且可以与 codeigniter 一起使用。

