magicalpanda/MagicalRecord — Issue #102: Why setIncludesSubentities:NO in MR_deleteAllMatchingPredicate:inContext: ?
Author: XMLSDK
Created: 2011-12-10 11:17:16+00:00
State: open

There is one line `[request setIncludesSubentities:NO];` within `+ (BOOL) MR_deleteAllMatchingPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context`. Is it intentionally not to delete subentities? It seems that if I want to delete all objects in an entity and its subentities, I have to repeatedly call methods like this:
```
[Animal MR_deleteAllMatchingPredicate...]; // Animals except cats, dogs and horses
[Cat MR_deleteAllMatchingPredicate...];
[Dog MR_deleteAllMatchingPredicate...];
[Horse MR_deleteAllMatchingPredicate...];
```
It looks like the behavior would be more consistent with fetch if deleteAllMatchingPredicate includes subentities by default. Or providing a method like `+ (BOOL) MR_deleteAllMatchingPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context includingSubentities:(BOOL)includingSubentities` to control the delete scope.