Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7cc4a28
Adds key path mapping support
Jun 13, 2014
6d1f00c
Adds additional attributes to Person entity from sample project
Jun 13, 2014
e60af92
Updates test
Jun 13, 2014
12a56be
Modifies sample JSON for tests
Jun 13, 2014
920e0f3
Adds keypath mapping test
Jun 13, 2014
22be2d4
Fixes last added test. Related to #97
Jun 13, 2014
c49b4bd
Adds +updateOrCreate method
Jun 15, 2014
ddbcdd8
Fixes +updateOrCreate method
Jun 15, 2014
812b8ed
Adds -saveInContext: method for custom context saving
Jun 15, 2014
9afa056
Adds model version support
Jun 16, 2014
3389708
Minor refactoring
Jun 18, 2014
c2fd6f3
Adds User mapping tests
Jun 19, 2014
b68f5ae
Adds +generalChannel convenience method
Jun 30, 2014
bd04135
Deprecates all convenience methods depending on a shared managed obje…
Jul 31, 2014
24088a4
Exposes managed object context variable as static class getter
Jul 31, 2014
4ee21e1
Updates all test with the latest deprecations
Jul 31, 2014
452d723
Re-ordering methods. Minor refactoring.
Jul 31, 2014
fb51e97
Removes CoreDataManager out of ObjectiveRecords library. Still using …
Jul 31, 2014
c4a43a7
Updates local pod
Jul 31, 2014
819d0c7
Reproduces crash in mapping of 3-level-deep nested relationships
Aug 5, 2014
24a4664
Adds ids and mappings to sample data models
Aug 5, 2014
1adf170
Adds son fixtures & json parser utility (instead of hardcoded diction…
Aug 6, 2014
81b6018
Minor minor test change.
Aug 6, 2014
be9abf0
added fail to appdelegate
bradya Aug 6, 2014
3e74bfa
Fixes crash when fetching one-to-many relationship with higher level …
Aug 6, 2014
652727b
Updates sample project
Aug 6, 2014
93406ad
Returns a IN predicate operation for containing one-to-many relations…
Aug 7, 2014
d4a8085
Clean the AppDelegate of the sample project
Aug 7, 2014
4411a50
Updates pod spec
Sep 29, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.log
Podfile.lock
.DS_Store
62 changes: 20 additions & 42 deletions Classes/NSManagedObject+ActiveRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,10 @@

#import <CoreData/CoreData.h>
#import "NSManagedObject+Mappings.h"
#import "CoreDataManager.h"

@interface NSManagedObjectContext (ActiveRecord)

/**
The default context (as defined on the @c CoreDataManager singleton).

@see -[CoreDataManager managedObjectContext]

@return A managed object context.
*/
+ (NSManagedObjectContext *)defaultContext;

@end

@interface NSManagedObject (ActiveRecord)


#pragma mark - Default Context

- (BOOL)save;
- (void)delete;
+ (void)deleteAll;

+ (id)create;
+ (id)create:(NSDictionary *)attributes;
- (void)update:(NSDictionary *)attributes;

+ (NSArray *)all;
+ (NSArray *)allWithOrder:(id)order;
+ (NSArray *)where:(id)condition, ...;
+ (NSArray *)where:(id)condition order:(id)order;
+ (NSArray *)where:(id)condition limit:(NSNumber *)limit;
+ (NSArray *)where:(id)condition order:(id)order limit:(NSNumber *)limit;
+ (instancetype)findOrCreate:(NSDictionary *)attributes;
+ (instancetype)find:(id)condition, ...;
+ (NSUInteger)count;
+ (NSUInteger)countWhere:(id)condition, ...;

#pragma mark - Custom Context

+ (id)createInContext:(NSManagedObjectContext *)context;
+ (id)create:(NSDictionary *)attributes inContext:(NSManagedObjectContext *)context;

+ (void)deleteAllInContext:(NSManagedObjectContext *)context;
#pragma mark - Finders

+ (NSArray *)allInContext:(NSManagedObjectContext *)context;
+ (NSArray *)allInContext:(NSManagedObjectContext *)context order:(id)order;
Expand All @@ -76,9 +35,28 @@
+ (NSArray *)where:(id)condition inContext:(NSManagedObjectContext *)context order:(id)order limit:(NSNumber *)limit;
+ (instancetype)findOrCreate:(NSDictionary *)properties inContext:(NSManagedObjectContext *)context;
+ (instancetype)find:(id)condition inContext:(NSManagedObjectContext *)context;

#pragma mark - Aggregation

+ (NSUInteger)countInContext:(NSManagedObjectContext *)context;
+ (NSUInteger)countWhere:(id)condition inContext:(NSManagedObjectContext *)context;

#pragma mark - Creation / Deletion

+ (id)createInContext:(NSManagedObjectContext *)context;
+ (id)create:(NSDictionary *)attributes inContext:(NSManagedObjectContext *)context;
+ (instancetype)updateOrCreate:(NSDictionary *)attributes inContext:(NSManagedObjectContext *)context;
- (void)update:(NSDictionary *)attributes inContext:(NSManagedObjectContext *)context;

#pragma mark - Deletion

- (void)deleteInContext:(NSManagedObjectContext *)contex;
+ (void)deleteAllInContext:(NSManagedObjectContext *)context;

#pragma mark - Saving

- (BOOL)saveInContext:(NSManagedObjectContext *)context;

#pragma mark - Naming

+ (NSString *)entityName;
Expand Down
Loading