clark
(clark)
1
Before parse.com, when I remove one, just call getRelation().remove({ Object Instance }).
It doesn’t needed load all relations data.
Backendless just guided using List<{Relate Object}>.remove({ Relate object instance }) and saving Object.
If I need delete someone, must loading relations for it like that?
is any other case have?
clark
(clark)
2
Example)
** this condition : not loaded relations data.
Place.class
class Place {
.....
List<BackendlessUser> favorites = new ArrayList<BackendlessUser>();
}
when User bookmarked :
place.favorites.add(User.class);
Backendless.Persistence.of(Place.class).save(place);
when user unbookmarked :
place.favorites.remove(User); // it can be? not loaded relations(favorites) data yet.
Backendless.Persistence.of(Place.class).save(place);
Hi Clark,
In case you just want to delete relation (unlink objects), here is the code you should use (it’s from the docs):
Backendless.Data.of( "Person" ).deleteRelation( parentObject, "address", children,
new AsyncCallback<Void>()
{
@Override
public void handleResponse( Void response )
{
Log.i( "MYAPP", "relation has been deleted" );
}
@Override
public void handleFault( BackendlessFault fault )
{
Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );
}
} );
There’s no such API for 3.x, in that version you’ll have to load relations and save the parent object, as you described.