RedBean简单模型
我被告知使用一些 ORM 库来使存储更容易。 我读过《Doctrine》、《红豆》和其他一些书。我尝试使用 RedBeans,因为它非常简单并且不需要配置。 我已经尝试过一些基本代码来存储 bean 等。
如果我想要一个模型类(一个bean?),添加一些基本的行为和功能。 我需要延长什么课程?我需要重写哪些方法,然后我应该如何获取它们的实例?
示例:包含用户和帖子的博客类
I've been told to use some ORM library to make storage easier.
I've read about Doctrine, RedBeans and some other ones. I'm giving RedBeans a try because it's quite simple and requires no configuration.
I already tried some basic code to store beans and so.
If I want to have a model class (a bean?), to add some basic behaviour and functions.
What class do I need to extend? What methods do I need to override and then how should I get an instance of them?
Example: a Blog class which contains a User and Posts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的问题的答案是 RedBean 的一个名为“Fuse”的功能。
它就像扩展 RedBean_SimpleModel 类并实现删除和更新方法一样简单。
RedBean 的缺点是缺乏教程/文档(他们的 wiki 真的很差)
The answer to my question was a feature of RedBean called 'Fuse'.
It was as simple as extending RedBean_SimpleModel class and implementing delete and update methods.
The downside of RedBean is the lack of tutorials/documentations (their wiki is really poor)