deleteRelation method
Future<int?>
deleteRelation(
- String parentObjectId,
- String relationColumnName, {
- List<
String> ? childrenObjectIds, - String? whereClause,
override
The API request has 2 options:
- Removes specific objects from a relationship by ID with their parent..
- Deletes objects from a relationship with their parent. The objects are identified implicitly through a
whereClause
condition.
At least 1 optional parameter must be defined. If 2 optional parameters are defined, 1 option is preferred. The API returns the number of child objects removed from the relationship.
Implementation
@override
Future<int?> deleteRelation(String parentObjectId, String relationColumnName,
{List<String>? childrenObjectIds, String? whereClause}) async {
String methodName = '/data/$tableName/$parentObjectId/$relationColumnName';
List? parameters;
if (childrenObjectIds?.isNotEmpty ?? false) {
parameters = childrenObjectIds;
} else if (whereClause?.isNotEmpty ?? false) {
methodName += '?where=$whereClause';
}
return await Invoker.delete(methodName, args: parameters);
}