哪个 ORM 用于 codeigniter? [英] Which ORM for codeigniter?

查看:33
本文介绍了哪个 ORM 用于 codeigniter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的引文已经说服最终走向 ORM.在过去,我并不是很喜欢 ORM,并认为它是一种愚蠢的执行 sql 的方式.在sql中处理分层数据是我不想处理的痛苦.

The quote below has convinced to finally go ORM. In the past I havn't really liked ORM and wrote it off as a stupid way of doing sql. Dealing with hierarchical data in sql is a pain I don't want to deal with.

我们有这些对象-关系映射器"是有原因的,这是因为一个称为对象-关系阻抗不匹配的问题.基本上,用于确保数据库保持完整的正式数学模型遵循具有行和列的表系统以及对其他表的引用,而我们今天使用的大多数编程语言中的数据结构以嵌套的树状结构操作数据.这更像是电子表格和 XML 文档之间的区别,或者分类帐和家谱图之间的区别.- http://zork.net/motd/nick/django/your-favorite-orm-sucks.html

There's a reason we have these "Object-Relational Mapper" things, and it's because of a problem known as the Object-Relational Impedance Mismatch. Basically, the formal mathematical model for databases used to ensure that they stay intact follows a system of tables with rows and columns and references to other tables, while data structures in most programming languages we use today manipulate data in nested tree-like structures. It's rather like the difference between a spreadsheet and an XML document, or between a ledger and a family tree diagram. - http://zork.net/motd/nick/django/your-favorite-orm-sucks.html

我想要一些轻松设置的东西.我的大部分项目都很小,所以当我只将它们用于少数查询时,我不想花太多时间定义模型.

I want something with minimal effort to setup. Most of my project are small so I don't want to spend much time defining models when I only use them for few queries.

我使用 codeigniter 作为 php 框架,使用 MySQL 作为数据库.

I'm using codeigniter as the php framework and MySQL as the database.

推荐答案

Doctrine 非常出色,并且非常易于设置和使用 CI.有三种集成方式 1) CI wiki 中描述的方式 2) 作为插件 3) 使用钩子.我不喜欢选项 1,因为它涉及弄乱 CI 系统文件.选项 2 非常简单,也是我目前使用的选项.www.phpandstuff.com 上介绍了设置.我从未尝试过选项 3,但听起来很有趣 - http://blog.medryx.org/2008/10/04/codeigniter-and-doctrine/

Doctrine is brilliant and very easy to setup and use with CI. There are three ways of integrating it 1) the way described in the CI wiki 2) as a plugin 3) using hooks. I don't like option 1 as it involves messing with CI system files. Option 2 is very easy and what i currently use. Setup is described at www.phpandstuff.com. I've never tried option 3 but it sounds interesting - http://blog.medryx.org/2008/10/04/codeigniter-and-doctrine/

这篇关于哪个 ORM 用于 codeigniter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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