Sparks+Php-activerecord - 值得使用它吗?

发布于 2024-12-26 04:25:19 字数 244 浏览 0 评论 0原文

我最近“发现”了与 CodeIgniter 一起使用的 Php-activerecord(使用 Sparks)。 这无疑是构建查询以及从数据库中获取数据的更简单的方法 而不是自己编写模型。

所以我的问题是:是否有人使用 php-activerecord,而不是 CodeIgniter 的内置 activerecord,来进行大型项目(即比典型的教程“博客”示例更大)? 当从 CodeIgniter 模型转向其他模型时,存在哪些陷阱?

谢谢

I've recently 'discovered' Php-activerecord for use with CodeIgniter (using Sparks).
It is surely an easier way of building queries and getting data in and out of the database
than coding the models for yourself.

So my question is: is somebody using php-activerecord, instead of CodeIgniter's builtin activerecord, for a large project (ie. larger than the typical, tutorialish 'blog' example)?
What pitfals are there, when moving on from CodeIgniter models?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小忆控 2025-01-02 04:25:19

ActiveRecord 似乎是一种众所周知的模式。在您的特定情况下,您应该记住,您不再需要 CodeIgniter AR 类和方法。

扩展 php-activerecord 模型为您提供了许多处理数据的标准化方法。这是您必须在每个项目中一遍又一遍地自己输入的代码的很大一部分(并且由于常见的 CRUD 操作,代码几乎是相同的)。

ActiveRecord seems to be a well known pattern. In your particular case you should bare in mind, that you no longer need the CodeIgniter AR classes and methods.

Extending the php-activerecord models gives you many standarized methods dealing with your data. That's a good portion of code you would have to type in for yourself over and over again in each project (and beacause of the common CRUD actions, the code would be almost the same).

云淡风轻 2025-01-02 04:25:19

很棒的图书馆!

我将它与我当前正在开发的 CMS 一起使用。
一旦你了解了人际关系,一切就变得轻而易举了。我发现使用 Activerecord\Model 类是一种乐趣,但是如果有一个基准测试包装器就更好了。实际上,如果您通过索引外键来正确设置数据库架构,它应该会有所帮助。

一些不错的功能

回调

急切加载

Great library!

I use it with my current CMS under development.
Once you get your head around relationships its a breeze. Activerecord\Model class is a joy to work with I find, however it would be nice to have a benchmarking wrapper. Really though if you have set your database architecture up right by indexing your foreign keys it should help.

Some nice features

callbacks

eager-loading

紙鸢 2025-01-02 04:25:19

我个人没有使用过 php-activerecord,但它看起来是一个很好的 ORM,并且有很好的文档。对于较大的项目来说,它看起来可以节省时间,但对于较小的项目,我可能会坚持使用标准的 activerecord 类。

I have not personally used php-activerecord but it looks like a good ORM with good documentation. It looks like a nice time saver for larger projects, but for smaller ones i'd probably just stick with the standard activerecord class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文