Skip to content

Commit

Permalink
Merge pull request #11 from kevindelord/remove_identifier_for_class
Browse files Browse the repository at this point in the history
Remove identifier for class
  • Loading branch information
kevindelord committed Jan 26, 2016
2 parents 058ca16 + ce8f616 commit ee9a620
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DKDBManager CHANGELOG

## 0.6.1

### DKDBManager

- Add `removeAllStoredIdentifiersForClass:` function.

## 0.6.0

- Rewrite test project in Swift.
Expand Down
11 changes: 11 additions & 0 deletions DKDBManager/DKDBManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@

#pragma mark - Delete methods

/**
* @brief Remove all stored identifiers of non-deprecated entities for a specific class.
*
* @remark The related entities will be considered as deprecated by the manager.
*
* @see Variable `NSMutableDictionary * storedIdentifiers`
*
* @param class The Class object referencing the model to delete the identifiers.
*/
+ (void)removeAllStoredIdentifiersForClass:(Class _Nullable)class;

/**
* @brief Remove all deprecated entities for every model class within a specific context.
*
Expand Down
8 changes: 8 additions & 0 deletions DKDBManager/DKDBManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ + (void)deleteAllEntitiesInContext:(NSManagedObjectContext * _Nonnull)context {
[self dumpInContext:context];
}

+ (void)removeAllStoredIdentifiersForClass:(Class _Nullable)class {

DKDBManager *manager = [DKDBManager sharedInstance];

NSString *className = NSStringFromClass(class);
[manager.storedIdentifiers removeObjectForKey:className];
}

+ (void)deleteAllEntitiesForClass:(Class)class inContext:(NSManagedObjectContext * _Nonnull)context {
if ([self.entityClassNames containsObject:NSStringFromClass(class)]) {
[class deleteAllEntitiesInContext:context];
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0
0.6.1

0 comments on commit ee9a620

Please sign in to comment.