I am struggling removing all related entries to a parent in a 1:n relationship. In the client order example this would be removing all orders of a customer. If I understand correctly, I cannot removeAll
because this would remove also the orders of all other customers.
I also don’t get this answer running. The _queryBuilder.backlink(...
(see 2nd snippet) throws:
The argument type ‘QueryRelationToOne<Order, Customer>’ can’t be assigned to the parameter type ‘QueryRelationToOne<Order, Order>’.
@Entity()
class Customer {
int id;
@Backlink('customer')
final orders = ToMany<Order>();
}
@Entity()
class Order {
int id;
final customer = ToOne<Customer>();
}
final QueryBuilder<Order> _queryBuilder = myBox.query();
_queryBuilder.backlink(Order_.customer, Order_.customer.equals(id));