有人知道不使用PDO的优秀PHP ORM吗? [英] Anyone know of a good PHP ORM that DOES NOT use PDO?

查看:93
本文介绍了有人知道不使用PDO的优秀PHP ORM吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为大型大学校园中的一个部门构建一个Web应用程序,该应用程序最终将在企业服务器上运行(我宽松地使用企业"一词).

I'm building a webapp for a department on a large college campus that will eventually be run on the enterprise servers ( I use the term 'enterprise' loosely ).

问题是管理员拒绝编译和启用除SQLite之外的任何PDO扩展.他们确实启用了mysql和mysqli,所以这并不是完全的损失.

那么,这里有没有人知道一个很好的PHP ORM,它不依赖PDO作为其主要引擎?

So does anybody out here know of a good ORM for PHP that does NOT rely on PDO as it's main engine?

我已经研究过Doctrine和Propel(两个优秀的框架),尽管无法弄清楚如何从它们内部提取PDO.

I've already looked at Doctrine and Propel (both excellent frameworks), though could not figure out how to rip PDO out from inside them.

编辑:这是我从服务器上的管理员那里得到的答复:

Edit: Here is the response I've gotten from the admins on the server:

塞恩

我们多次尝试构建包含PDO扩展名的PHP,但均未成功.我们未能成功的原因很复杂,但基本上是由于这样的事实,即网络环境最初是由一些静态编译的数据库驱动程序库和动态编译的一些数据库驱动程序库设置的,这种混合导致PDO大声抱怨.这样做的原因是由于PHP 5.x的早期版本中的一个错误已不再是今天的问题(或至少不再是一个问题),但是切换很困难,因为更改需要对php进行修改. ini文件,并且由于每个站点(包括[服务器上的站点]上的站点)都有其自己的php.ini(总共约22,000个文件,其中许多是由用户修改的),因此很难推出更改(不进行更改会导致错误的信息[我不记得它们是否致命]在具有未更新文件的帐户提供的页面上显示.)

We have tried, unsuccessfully, several times to build PHP with the PDO extension included. The reason we haven't been successful is complicated, but basically stems from the fact that the web envoronment was originally set up with some database driver libraries compiled staticly and others compiled dynamically, the mix causing PDO to complain loudly. The reason things were were done this way was due to a bug in early versions of PHP 5.x that is no longer an issue today (or at least less of one), but switching is difficult because the change would require modifications to php.ini files and, since every site (including sites on [server redacted]) has its own php.ini (roughly 22,000 files total, many of which are modified by users) it is very difficult to push out that change (and not making the change causes errors [I don't recall if they are fatal or not] on pages served from accounts with non-updated files).

推荐答案

我想每个现代的ORM都依赖PDO,因为它是标准的数据库驱动程序.

I suppose that every modern ORM relies on PDO as it's a standard database driver.

如果您启用了 MySQLi扩展,那么您应该能够编写自己的PDO(IIRC MySQLi支持PDO所做的一切).

If you have MySQLi extension enabled then you should be able to write your own PDO (IIRC MySQLi supports everything that PDO does).

if (extension_loaded('pdo_mysql') == false) {
    class PDO {
        protected $connection;

        public function __construct($dsn, $username = null, $password = null, array $driver_options = array()) {
            $this->connection = new MySQLi(...);
        }
    }

    class PDOStatement { ... }
    class PDOException extends RuntimeException { ... }
}

您必须实现整个PDO API,但至少它可以工作.

You'll have to implement whole PDO API but at least it will works.

这篇关于有人知道不使用PDO的优秀PHP ORM吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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