什么是最简单的针对PHP的ORM框架? [英] What is the easiest to use ORM framework for PHP?

查看:115
本文介绍了什么是最简单的针对PHP的ORM框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Ruby在PHP上的Active记录.事情如此简单,以至于我只需定义自己的字段,扩展基本的ORM类,就可以免费获得ACID操作.我应该在不编写任何代码的情况下获取默认的getter和setter,但是覆盖默认的getter或setter就像声明get $ fieldName或set $ fieldName函数一样简单. Symphony使您可以为每个对象创建大约5个文件,并且据我所知,所有定义的对象始终会加载.有什么更好的选择?为什么会更好?您能在答案中放一些简单的例子吗?

I'm looking for Ruby's Active record for PHP. Something that is so simple that I just define my fields, extend the base ORM class, and I get ACID operations for free. I should get default getters and setters without writing any code, but overriding a default getter or setter is as easy as declaring get$fieldName or set$fieldName functions with the behavior I want. Symphony makes you create about 5 files per object, and all defined objects always load as far as I can tell. What is a better alternative? Why is it better? Can you put simple examples in your answers please?

除了交响曲,Doctrine是我看过的另一个ORM.您还需要创建描述您的数据结构的yaml文件.数据库已经定义了这些东西.什么会读到我的表def,而不必在任何地方生成和存储配置文件?

Doctrine is another ORM I've looked at besides symphony . There also you need to create yaml files that describe your data structures. The database already defines this stuff. What will just read my table defs without having to generate and store config files everywhere?

推荐答案

两个CodeIgniter( http://codeigniter.com/user_guide/database/active_record.html )及其仅PHP5的分叉Kohana( http ://docs.kohanaphp.com/libraries/orm )包含ActiveRecord模式的实现.

Both CodeIgniter (http://codeigniter.com/user_guide/database/active_record.html) and its PHP5 only fork Kohana (http://docs.kohanaphp.com/libraries/orm) contain implementations of the ActiveRecord pattern.

这篇关于什么是最简单的针对PHP的ORM框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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