Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

177 lines (150 sloc) 6.957 kB
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.m instead.
#import "_<$managedObjectClassName$>.h"
@implementation <$managedObjectClassName$>ID
@end
@implementation _<$managedObjectClassName$>
+ (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ {
NSParameterAssert(moc_);
return [NSEntityDescription insertNewObjectForEntityForName:@"<$name$>" inManagedObjectContext:moc_];
}
+ (NSString*)entityName {
return @"<$name$>";
}
+ (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_ {
NSParameterAssert(moc_);
return [NSEntityDescription entityForName:@"<$name$>" inManagedObjectContext:moc_];
}
- (<$managedObjectClassName$>ID*)objectID {
return (<$managedObjectClassName$>ID*)[super objectID];
}
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$><$if Attribute.hasScalarAttributeType$>
if ([key isEqualToString:@"<$Attribute.name$>Value"]) {
NSSet *affectingKey = [NSSet setWithObject:@"<$Attribute.name$>"];
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey];
}<$endif$><$endif$><$endforeach do$>
return keyPaths;
}
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasDefinedAttributeType$>
@dynamic <$Attribute.name$>;
<$if Attribute.hasScalarAttributeType$>
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value {
NSNumber *result = [self <$Attribute.name$>];
return [result <$Attribute.scalarAttributeType.camelCaseString$>Value];
}
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self set<$Attribute.name.initialCapitalString$>:[NSNumber numberWith<$Attribute.scalarAttributeType.camelCaseString.initialCapitalString$>:value_]];
}
- (<$Attribute.scalarAttributeType$>)primitive<$Attribute.name.initialCapitalString$>Value {
NSNumber *result = [self primitive<$Attribute.name.initialCapitalString$>];
return [result <$Attribute.scalarAttributeType.camelCaseString$>Value];
}
- (void)setPrimitive<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self setPrimitive<$Attribute.name.initialCapitalString$>:[NSNumber numberWith<$Attribute.scalarAttributeType.camelCaseString.initialCapitalString$>:value_]];
}
<$endif$>
<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
@dynamic <$Relationship.name$>;
<$if Relationship.isToMany$>
- (<$Relationship.mutableCollectionClassName$>*)<$Relationship.name$>Set {
[self willAccessValueForKey:@"<$Relationship.name$>"];
<$Relationship.mutableCollectionClassName$> *result = [self mutableSetValueForKey:@"<$Relationship.name$>"];
[self didAccessValueForKey:@"<$Relationship.name$>"];
return result;
}
<$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
@dynamic <$FetchedProperty.name$>;
<$endforeach do$>
<$foreach FetchRequest prettyFetchRequests do$>
<$if FetchRequest.singleResult$>
+ (id)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>{
NSError *error = nil;
id result = [self fetch<$FetchRequest.name.initialCapitalString$>:moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:<$Binding.name$>_ <$endforeach do2$>error:&error];
if (error) {
#if TARGET_OS_IPHONE
NSLog(@"error: %@", error);
#else
[NSApp presentError:error];
#endif
}
return result;
}
+ (id)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;
NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
<$foreach Binding FetchRequest.bindings do2$>
<$Binding.name$>_, @"<$Binding.name$>",
<$endforeach do2$>
nil];
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionary];
<$endif$>
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");
id result = nil;
NSArray *results = [moc_ executeFetchRequest:fetchRequest error:&error];
if (!error) {
switch ([results count]) {
case 0:
// Nothing found matching the fetch request. That's cool, though: we'll just return nil.
break;
case 1:
result = [results objectAtIndex:0];
break;
default:
NSLog(@"WARN fetch request <$FetchRequest.name$>: 0 or 1 objects expected, %u found (substitutionVariables:%@, results:%@)",
[results count],
substitutionVariables,
results);
}
}
if (error_) *error_ = error;
return result;
}
<$else$>
+ (NSArray*)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>{
NSError *error = nil;
NSArray *result = [self fetch<$FetchRequest.name.initialCapitalString$>:moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:<$Binding.name$>_ <$endforeach do2$>error:&error];
if (error) {
#if TARGET_OS_IPHONE
NSLog(@"error: %@", error);
#else
[NSApp presentError:error];
#endif
}
return result;
}
+ (NSArray*)fetch<$FetchRequest.name.initialCapitalString$>:(NSManagedObjectContext*)moc_ <$foreach Binding FetchRequest.bindings do2$><$Binding.name$>:(<$Binding.type$>)<$Binding.name$>_ <$endforeach do2$>error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;
NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
<$foreach Binding FetchRequest.bindings do2$>
<$Binding.name$>_, @"<$Binding.name$>",
<$endforeach do2$>
nil];
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionary];
<$endif$>
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");
NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error];
if (error_) *error_ = error;
return result;
}
<$endif$>
<$endforeach do$>
@end
Jump to Line
Something went wrong with that request. Please try again.