thiagolocatelli / parse4j

Java Library to deal with Parse (parse.com) REST API
http://thiagolocatelli.github.io/parse4j
143 stars 117 forks source link

Removing multiple objects from ParseRelation #14

Open jbrindarolli opened 10 years ago

jbrindarolli commented 10 years ago

Hello,

I am trying to remove a dozens of objects from a relation, but only the last object in the loop is being removed. The previous object are discarded from "remove list". In "operation" field I can see only the last one. Someone else had the same problem?

If I remove only one object and then save to Parse, every works fine.

Thanks

ucarseyhan commented 10 years ago

Dear jbrindarolli ,

Maybe it is related with ACL values. Please provide some code details. One solution can be using the ParseCloud function and calling from Parse4J.

Regards.

jbrindarolli commented 10 years ago

Dear ucarseyhan,

Thanks for your answer. The problem happens before send update to Parse. Please see below the code I use to remove items from a relation. If I send a list of objectId to be removed from the relation, only the last one is removed. If I remove and save on Parse one by one, it works. Regards

public void removeItens(ArrayList<String> listaId) {
        for (String itemId : listaId) {
            if (this.relationItens == null) {
                this.relationItens =  this.getRelation("itens");
            }
            this.relationItens.remove(ParseObject.createWithoutData("APItem", itemId));
        }
}