delete method

  1. @override
FutureOr<Iterable<O>> delete(
  1. EntityMatcher<O> matcher, {
  2. Object? parameters,
  3. List? positionalParameters,
  4. Map<String, Object?>? namedParameters,
  5. Transaction? transaction,
})
override

Implementation

@override
FutureOr<Iterable<O>> delete(EntityMatcher<O> matcher,
    {Object? parameters,
    List? positionalParameters,
    Map<String, Object?>? namedParameters,
    Transaction? transaction}) {
  checkNotClosed();

  var canPropagate =
      hasReferencedEntities(resolveEntityResolutionRules(null));

  var op = TransactionOperationDelete(
      name, canPropagate, operationExecutor, matcher,
      transaction: transaction);

  try {
    return repositoryAdapter.doDelete(op, matcher,
        parameters: parameters,
        positionalParameters: positionalParameters,
        namedParameters: namedParameters, preFinish: (results) {
      return resolveEntities(op.transaction, results)
          .resolveMapped((entities) {
        untrackEntities(entities, deleted: true);
        return entities;
      });
    });
  } catch (e, s) {
    var message = 'delete> '
        'matcher: $matcher ; '
        'parameters: $parameters ; '
        'positionalParameters: $positionalParameters ; '
        'namedParameters: $namedParameters ; '
        'op: $op';
    _log.severe(message, e, s);
    rethrow;
  }
}