Extjs MVC 操作关联数据
我有一个用户模型,其中有许多订单和许多文章。 如果我想删除用户记录,如果我没有弄错的话,我会通过 record.remove() ,但是如何删除该用户的所有订单?
从逻辑上讲,我会使用 record.getAssociatedData('orders').remove() 但 'getAssociatedData' 不接受任何参数。
非常感谢任何帮助。
I have a User model which hasMany Orders and many Articles.
If I want to delete a User record I go by record.remove() if I'm not mistaken but how do I delete all orders of this user for example?
Logically I would go by record.getAssociatedData('orders').remove() but 'getAssociatedData' does not accept any parameters.
Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对于获取数据可能没问题,但对于删除则不行!此操作属于数据库或至少属于服务器。在客户端做引用完整性确实很糟糕!别这样。
This may be ok for fetching data but not for deleting! This action belongs to the DataBase or at least the server. It is really bad to do the referential integrity on the client! Don't to this.