简体   繁体   English

顺便说一下,parse.com删除对象,删除与之相关的对象

[英]parse.com delete object ,by the way,delete the objects it relate to

I created an relation from PFObject to anotherPFobject ,such as: 我创建了一个从PFObject到另一个PF对象的关系,例如:

[relation addobject:object1];         
[mainObject setobject:relation forkey:@"relate"];         
[mainObject save];         

the "relate" property is an one to many relationship; “关联”财产是一对多的关系;
Then,if i delete the mainObject 然后,如果我删除mainObject

[mainObject delete];         

what i want to konw is that how can i delete the objects the "relate" property related to. 我想要知道的是,我如何删除与“相关”属性相关的对象。 Thank in advance. 预先感谢。

You can use an afterDelete cloude code hook to accomplish this, per the guide here: https://parse.com/docs/cloud_code_guide#functions-afterdelete 根据以下指南,您可以使用afterDelete cloude代码钩子完成此操作: https ://parse.com/docs/cloud_code_guide#functions-afterdelete

source: https://www.parse.com/questions/newb-trying-to-cascade-deletes 来源: https//www.parse.com/questions/newb-trying-to-cascade-deletes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM