Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added aggregate methods to the category header and added MR_ prefix to method names #105

Merged
merged 2 commits into from

2 participants

@duanefields

I'm still not able to call these with the method swizzling, I have to explicitly call MR_aggregate... something I don't understand I guess.

@magicalpanda
@magicalpanda magicalpanda merged commit 6d94f4a into magicalpanda:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 10, 2011
  1. @duanefields
Commits on Dec 11, 2011
  1. @duanefields
This page is out of date. Refresh to see the latest.
View
2  Source/Categories/NSManagedObject+MagicalRecord.h
@@ -99,6 +99,8 @@
+ (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending;
+ (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context;
++ (NSNumber *)MR_aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context;
++ (NSNumber *)MR_aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate;
- (id) MR_inContext:(NSManagedObjectContext *)otherContext;
- (id) MR_inThreadContext;
View
6 Source/Categories/NSManagedObject+MagicalRecord.m
@@ -737,7 +737,7 @@ - (id) MR_objectWithMinValueFor:(NSString *)property
return [self MR_objectWithMinValueFor:property inContext:[self managedObjectContext]];
}
-+ (NSNumber *)aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context
++ (NSNumber *) MR_aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context
{
NSExpression *ex = [NSExpression expressionForFunction:function
arguments:[NSArray arrayWithObject:[NSExpression expressionForKeyPath:attributeName]]];
@@ -762,9 +762,9 @@ + (NSNumber *)aggregateOperation:(NSString *)function onAttribute:(NSString *)at
return resultValue;
}
-+ (NSNumber *)aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate
++ (NSNumber *) MR_aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate
{
- return [self aggregateOperation:function
+ return [self MR_aggregateOperation:function
onAttribute:attributeName
withPredicate:predicate
inContext:[NSManagedObjectContext MR_defaultContext]];
View
2  Source/MagicalRecordShorthand.h
@@ -87,6 +87,8 @@
+ (NSArray *) findByAttribute:(NSString *)attribute withValue:(id)searchValue inContext:(NSManagedObjectContext *)context;
+ (NSArray *) findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending;
+ (NSArray *) findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context;
++ (NSNumber *)aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate inContext:(NSManagedObjectContext *)context;
++ (NSNumber *)aggregateOperation:(NSString *)function onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate;
- (id) inContext:(NSManagedObjectContext *)otherContext;
- (id) inThreadContext;
+ (void) performFetch:(NSFetchedResultsController *)controller;
Something went wrong with that request. Please try again.