redbean 是 knockoutjs 的可行 orm 吗?
redbeanphp 的 bean 可以服务器成为淘汰赛的有用 orm (使用映射插件吗?)。我有(或将有)一个mysql数据库,其中有许多一对多、多对多和一对一的关系。我想在基于单一表单的界面中将记录及其所有相关数据作为对象进行编辑。
就 ui 而言,我将使用嵌套的 json 对象,在 html 中查看它,并使用表单元素模板对其进行编辑,根据需要将它们添加到 dom 中。
beancan 服务器(或简单的导出/导入函数)会将 beans 转换为 json 对象(反之亦然),knockout 将处理对对象的修改。然后,beancan 服务器将使用 mysql 数据库管理 CRUD 功能。我知道,我可能应该使用无模式数据库,如 couchdb 或类似的数据库,但在这种情况下,它不是一个选择。
这很离谱吗?或者可能可行吗?我似乎无法找到任何具有任何复杂性的 Redbean 往返示例,所以我不知道这是否有意义。我在框架方面取得了很多成功——在很大程度上不是程序员,但如果给出一个具体的示例,我就能够掌握一个概念。任何帮助将不胜感激。
would redbeanphp's bean can server be a useful orm for knockout (using the mapping plugin?). i have (or will have) a mysql database with many one to many, many to many, and one to one relationships. i would like to edit a record and all its related data as an object in a single form based interface.
as far as the ui is concerned, i would be working with a nested json object, viewing it in html, and editing it using form element templates, adding them to the dom as needed.
beancan server (or simply the export/import functions) would convert beans into json objects (and vice versa), knockout would handle the modifications to the object. beancan server would then manage the crud functions with the mysql database. i know, i should probably be using a schemaless database like couchdb or somesuch, but in this case it isn't an option.
is this outrageous? or possible workable? i can't seem to locate any round trip examples with any complexity for redbean, so i don't know if this makes sense or not. i've had a lot of success with frameworks -- not being a programmer for the most part, but able to grasp a concept if given a concrete example to work from. any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前从未使用过 redbean,但作为一名狂热的 KnockoutJS 用户,我可以告诉你这听起来很合理。
您将模型对象转换为 JSON,通过 KnockoutJS 在 UI 中操作它们,然后将它们发送回服务器进行保存。
这是完全合理的,也是我们做事的典型方式,无论 ORM 是什么。实际上,ORM 不应该影响您使用的 UI 技术。在这种情况下,只要您的对象可以与 JSON 相互转换,就应该没问题。
I've never used redbean before, but as an avid KnockoutJS user, I can tell you this sounds reasonable.
You're converting your model objects to JSON, manipulating them in the UI via KnockoutJS, then sending them back to the server for saving.
That's perfectly reasonable and is typically how we do things, no matter the ORM. Really, the ORM should not affect the UI tech you use. And in this case, as long as your objects can be converted to/from JSON, you should be just fine.