mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
Follow coding style, fixed problems with wrong context
This commit is contained in:
@@ -617,21 +617,22 @@ static NSUInteger defaultBatchSize = kMagicalRecordDefaultBatchSize;
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL) deleteAllMatchingPredicate:(NSPredicate *)predicate {
|
||||
+ (BOOL) deleteAllMatchingPredicate:(NSPredicate *)predicate
|
||||
{
|
||||
return [self deleteAllMatchingPredicate:predicate inContext:[NSManagedObjectContext defaultContext]];
|
||||
}
|
||||
|
||||
+ (BOOL) deleteAllMatchingPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context {
|
||||
NSFetchRequest *request = [self requestAllInContext:context];
|
||||
[request setPredicate:predicate];
|
||||
+ (BOOL) deleteAllMatchingPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context
|
||||
{
|
||||
NSFetchRequest *request = [self requestAllWithPredicate:predicate inContext:context];
|
||||
[request setIncludesSubentities:NO];
|
||||
[request setIncludesPropertyValues:NO];
|
||||
[request setFetchBatchSize:[self defaultBatchSize]];
|
||||
|
||||
NSArray *objectsToTruncate = [self executeFetchRequest:request];
|
||||
NSArray *objectsToTruncate = [self executeFetchRequest:request inContext:context];
|
||||
|
||||
for (id objectToTruncate in objectsToTruncate) {
|
||||
[objectToTruncate deleteEntity];
|
||||
for (id objectToTruncate in objectsToTruncate)
|
||||
{
|
||||
[objectToTruncate deleteInContext:context];
|
||||
}
|
||||
|
||||
return YES;
|
||||
|
||||
Reference in New Issue
Block a user