Kohana 3.1 有哪些 ORM 解决方案可用?
Kohana 3.0 过去除了默认的 ORM 系统之外还有 Sprig、Jelly 等。据我了解,Kohana 3.1 与 Sprig 和 Jelly 不兼容,其默认 ORM 仍在开发中。那么在 Kohana 3.1 中使用什么来进行 ORM 呢?
Kohana 3.0 used to have Sprig, Jelly, etc. alongside with its default ORM system. As far as I understand, Kohana 3.1 is not compatible with Sprig and Jelly and its default ORM is still in development. What to use for ORM in Kohana 3.1 then?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看 Kohana 的 Leap ORM。您可以从 github 下载它 https://github.com/spadefoot/kohana-orm-leap< /a>
此 ORM 设计用于与 Kohana 3.0.X、Kohana 3.1.X 和 Kohana 3.2 配合使用。与我见过的其他 Kohana ORM 不同,它适用于所有主要数据库(包括 MySQL、MariaDB、PostgresSQL、MS SQL、DB2、Oracle、Firebird 和 Sqlite)。扩展 ORM 非常容易,而如果不做大量工作,Kohana 的默认 ORM 就无法适应此类数据库。
它有很好的记录。与我见过的 Kohana 的其他 ORM 不同,它可以处理复合主键,并且可以使用多个整数作为主键(例如字符串)。它还使您可以使用简单的配置文件灵活地将数据库驱动程序从标准 PHP 扩展切换到 PDO。
Take a look at Leap ORM for Kohana. You can download it off github at https://github.com/spadefoot/kohana-orm-leap
This ORM is designed to work with Kohana 3.0.X, Kohana 3.1.X, and Kohana 3.2. It works with all major databases (including MySQL, MariaDB, PostgresSQL, MS SQL, DB2, Oracle, Firebird, and Sqlite) unlike the other Kohana ORMs that I have seen. Expanding the ORM is extremely easy whereas Kohana's default ORM cannot be adapted to work with such databases without a lot of work.
It is pretty well documented. Unlike other ORMs for Kohana that I have seen, it can handle composite primary keys and can use more than integers as primary keys (e.g. strings). It also give you the flexibility to switch the database driver from the standard PHP extensions to PDO using a simple config file.
您可以在 Github 上找到 3.1 模块:
Jelly for 3.1(非官方分支,Banks 和 Jonathan Geiger 没有时间开发)
Sprig 分支 for 3.1
You can find 3.1 modules at Github:
Jelly for 3.1 (unofficial fork, Banks and Jonathan Geiger have no time for development)
Sprig branch for 3.1
您检查过 PHP ActiveRecord 吗?它是一个 ActiveRecord 风格的 ORM,具有验证、关系、急切加载等功能。
Have you checked out PHP ActiveRecord? It is an ActiveRecord style ORM with validations, realtionships, eager loading, etc.
我强烈建议您使用:
http://www.doctrine-project.org/projects/orm
我都使用过Kohana 3.0 中的默认 ORM(应该与 3.1 中的类似)以及大型项目中的 ORM 原则。
教义是伟大的。你想要的一切都在那里。即使对于非常特殊和棘手的情况也是如此。如果您使用默认的 Kohana 3 ORM,您最终将扩展它,因为它太简单了。
Doctrine 中的配置部分可能有点可怕,因为有很多选项。从长远来看,这确实是值得的:)
I strongly suggest you to use:
http://www.doctrine-project.org/projects/orm
I have used both the default ORM in Kohana 3.0 (should be similar to the one in 3.1) and the doctrine ORM in big projects.
Doctrine is great. Everything you wan't is there. Even for very special and tricky cases. If you use the default Kohana 3 ORM you will end up extending it because it is to simple.
The configuration part in Doctrine can be a little scary because there are a lot of options. In the long run it is really worth it though :)