Commit 6fac2dcd by Brent Gulanowski

Add templates for model generation with mogenerator.

parent 2742f8e0
...@@ -467,6 +467,7 @@ ...@@ -467,6 +467,7 @@
8498108F1CB7E07900CFAB58 /* BUYDeliveryRangeTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYDeliveryRangeTransformer.m; sourceTree = "<group>"; }; 8498108F1CB7E07900CFAB58 /* BUYDeliveryRangeTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYDeliveryRangeTransformer.m; sourceTree = "<group>"; };
849810901CB7E07900CFAB58 /* BUYFlatCollectionTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYFlatCollectionTransformer.h; sourceTree = "<group>"; }; 849810901CB7E07900CFAB58 /* BUYFlatCollectionTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYFlatCollectionTransformer.h; sourceTree = "<group>"; };
849810911CB7E07900CFAB58 /* BUYFlatCollectionTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYFlatCollectionTransformer.m; sourceTree = "<group>"; }; 849810911CB7E07900CFAB58 /* BUYFlatCollectionTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYFlatCollectionTransformer.m; sourceTree = "<group>"; };
849810A61CB7E1E100CFAB58 /* Templates */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Templates; sourceTree = "<group>"; };
900396991B601DF400226B73 /* BUYCartLineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYCartLineItem.h; sourceTree = "<group>"; }; 900396991B601DF400226B73 /* BUYCartLineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYCartLineItem.h; sourceTree = "<group>"; };
9003969A1B601DF400226B73 /* BUYCartLineItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYCartLineItem.m; sourceTree = "<group>"; }; 9003969A1B601DF400226B73 /* BUYCartLineItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYCartLineItem.m; sourceTree = "<group>"; };
900396AA1B627CB900226B73 /* BUYProductView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = BUYProductView.h; path = "Product View/BUYProductView.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 900396AA1B627CB900226B73 /* BUYProductView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = BUYProductView.h; path = "Product View/BUYProductView.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
......
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Buy/_<$managedObjectClassName$>.h>
@interface <$managedObjectClassName$> : _<$managedObjectClassName$> {}
@end
//
// _<$managedObjectClassName$>.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "<$managedObjectClassName$>.h"
@implementation <$managedObjectClassName$>
@end
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.h instead.
#import <Buy/BUYManagedObject.h>
<$if hasAdditionalHeaderFile$>
#import "<$additionalHeaderFileName$>"
<$endif$>
#import "BUYModelManager.h"
<$if noninheritedAttributes.@count > 0$>
extern const struct <$managedObjectClassName$>Attributes {<$foreach Attribute noninheritedAttributes do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Attribute.name$>;<$endforeach do$>
} <$managedObjectClassName$>Attributes;
<$endif$>
<$if noninheritedRelationships.@count > 0$>
extern const struct <$managedObjectClassName$>Relationships {<$foreach Relationship noninheritedRelationships do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Relationship.name$>;<$endforeach do$>
} <$managedObjectClassName$>Relationships;
<$endif$>
<$if noninheritedFetchedProperties.@count > 0$>
extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach FetchedProperty noninheritedFetchedProperties do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$FetchedProperty.name$>;<$endforeach do$>
} <$managedObjectClassName$>FetchedProperties;
<$endif$>
<$if hasUserInfoKeys$>
extern const struct <$managedObjectClassName$>UserInfo {<$foreach UserInfo userInfoKeyValues do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$UserInfo.key$>;<$endforeach do$>
} <$managedObjectClassName$>UserInfo;
<$endif$>
<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$><$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasTransformableAttributeType$>
<$if Attribute.objectAttributeTransformableProtocols$><$foreach Protocol Attribute.objectAttributeTransformableProtocols do$>@protocol <$Protocol$>;
<$endforeach do$><$else$>@class <$Attribute.objectAttributeClassName$>;<$endif$><$endif$>
<$endforeach do$>
@class <$managedObjectClassName$>;
@interface BUYModelManager (<$managedObjectClassName$>Inserting)
- (NSArray<<$managedObjectClassName$> *> *)all<$name$>Objects;
- (<$managedObjectClassName$> *)fetch<$name$>WithIdentifierValue:(int64_t)identifier;
- (<$managedObjectClassName$> *)insert<$name$>WithJSONDictionary:(NSDictionary *)dictionary;
- (NSArray<<$managedObjectClassName$> *> *)insert<$name$>sWithJSONArray:(NSArray <NSDictionary *> *)array;
@end
<$if userInfo.documentation$>
/**
* <$userInfo.documentation$><$if userInfo.discussion$>
*
* <$userInfo.discussion$><$endif$>
*/<$endif$>
@interface _<$managedObjectClassName$> : <$customSuperentity$>
+ (NSString *)entityName;
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.userInfo.documentation$>
/**
* <$Attribute.userInfo.documentation$><$if Attribute.userInfo.discussion$>
*
* <$Attribute.userInfo.discussion$><$endif$>
*/<$endif$><$if Attribute.hasDefinedAttributeType$><$if TemplateVar.arc$><$if Attribute.isReadonly$>
@property (nonatomic, strong, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, strong) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$else$><$if Attribute.isReadonly$>
@property (nonatomic, retain, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, retain) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$><$endif$>
<$if Attribute.hasScalarAttributeType$>
<$if Attribute.isReadonly$>
@property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
<$else$>
@property (atomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_;
<$endif$><$endif$><$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.userInfo.documentation$>
/**
* <$Relationship.userInfo.documentation$><$if Relationship.userInfo.discussion$>
*
* <$Relationship.userInfo.discussion$><$endif$>
*/<$endif$><$if Relationship.isToMany$><$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;<$else$>
@property (nonatomic, retain) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$endif$>
- (<$Relationship.mutableCollectionClassName$> *)<$Relationship.name$>Set;
<$else$>
<$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$endif$><$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
<$if FetchedProperty.userInfo.documentation$>
/**
* <$FetchedProperty.userInfo.documentation$><$if FetchedProperty.userInfo.documentation$>
*
* <$FetchedProperty.userInfo.discussion$><$endif$>
*/<$endif$>
@property (nonatomic, readonly) NSArray *<$FetchedProperty.name$>;
<$endforeach do$>
<$if TemplateVar.frc$>
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors;
<$endif$>
<$endforeach do$>
#endif
<$endif$>
@end
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
@interface _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
<$if Relationship.isOrdered$>
- (void)insertObject:(<$Relationship.destinationEntity.managedObjectClassName$> *)value in<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)removeObjectFrom<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)insert<$Relationship.name.initialCapitalString$>:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
- (void)remove<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectIn<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx withObject:(<$Relationship.destinationEntity.managedObjectClassName$> *)value;
- (void)replace<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes with<$Relationship.name.initialCapitalString$>:(NSArray *)values;
<$endif$>
@end
<$endif$>
<$endforeach do$>
@interface _<$managedObjectClassName$> (CoreDataGeneratedPrimitiveAccessors)
<$foreach Attribute noninheritedAttributesSansType do$>
<$if Attribute.hasDefinedAttributeType$>
- (<$Attribute.objectAttributeType$>)primitive<$Attribute.name.initialCapitalString$>;
- (void)setPrimitive<$Attribute.name.initialCapitalString$>:(<$Attribute.objectAttributeType$>)value;
<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (<$Relationship.mutableCollectionClassName$> *)primitive<$Relationship.name.initialCapitalString$>;
- (void)setPrimitive<$Relationship.name.initialCapitalString$>:(<$Relationship.mutableCollectionClassName$> *)value;
<$else$>
- (<$Relationship.destinationEntity.managedObjectClassName$> *)primitive<$Relationship.name.initialCapitalString$>;
- (void)setPrimitive<$Relationship.name.initialCapitalString$>:(<$Relationship.destinationEntity.managedObjectClassName$> *)value;
<$endif$>
<$endforeach do$>
@end
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.m instead.
#import "_<$managedObjectClassName$>.h"
<$if noninheritedAttributes.@count > 0$>
const struct <$managedObjectClassName$>Attributes <$managedObjectClassName$>Attributes = {<$foreach Attribute noninheritedAttributes do$>
.<$Attribute.name$> = @"<$Attribute.name$>",<$endforeach do$>
};
<$endif$>
<$if noninheritedRelationships.@count > 0$>
const struct <$managedObjectClassName$>Relationships <$managedObjectClassName$>Relationships = {<$foreach Relationship noninheritedRelationships do$>
.<$Relationship.name$> = @"<$Relationship.name$>",<$endforeach do$>
};
<$endif$>
<$if noninheritedFetchedProperties.@count > 0$>
const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassName$>FetchedProperties = {<$foreach FetchedProperty noninheritedFetchedProperties do$>
.<$FetchedProperty.name$> = @"<$FetchedProperty.name$>",<$endforeach do$>
};
<$endif$>
<$if hasUserInfoKeys$>
const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserInfo = {<$foreach UserInfo userInfoKeyValues do$>
.<$UserInfo.key$> = @"<$UserInfo.value$>",<$endforeach do$>
};
<$endif$>
@implementation _<$managedObjectClassName$>
+ (NSString *)entityName {
return @"<$name$>";
}
+ (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];
return keyPaths;
}<$endif$><$endif$><$endforeach do$>
return keyPaths;
}
#if defined CORE_DATA_PERSISTENCE<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$>
- (<$Attribute.objectAttributeType$>)<$Attribute.name$> {
[self willAccessValueForKey:@"<$Attribute.name$>"];
id value = [self primitiveValueForKey:@"<$Attribute.name$>"];
[self didAccessValueForKey:@"<$Attribute.name$>"];
return value;
}
<$if ! Attribute.isReadonly$>
- (void)set<$Attribute.name.initialCapitalString$>:(<$Attribute.objectAttributeType$>)value_ {
[self willChangeValueForKey:@"<$Attribute.name$>"];
[self setPrimitiveValue:value_ forKey:@"<$Attribute.name$>"];
[self didChangeValueForKey:@"<$Attribute.name$>"];
}
<$endif$><$endif$><$endforeach do$>
#endif
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasDefinedAttributeType$>
<$if Attribute.hasScalarAttributeType$>
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value {
NSNumber *result = [self <$Attribute.name$>];
return [result <$Attribute.scalarAccessorMethodName$>];
}
<$if ! Attribute.isReadonly$>
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self set<$Attribute.name.initialCapitalString$>:<$if TemplateVar.literals$>@(value_)<$else$>[NSNumber <$Attribute.scalarFactoryMethodName$>value_]<$endif$>];
}
<$endif$>
<$endif$>
<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
#if defined CORE_DATA_PERSISTENCE
@dynamic <$Relationship.name$>;
#endif
<$if Relationship.isToMany$>
- (<$Relationship.mutableCollectionClassName$> *)<$Relationship.name$>Set {
[self willAccessValueForKey:@"<$Relationship.name$>"];
<$if Relationship.jr_isOrdered$>
<$Relationship.mutableCollectionClassName$> *result = (<$Relationship.mutableCollectionClassName$> *)[self mutableOrderedSetValueForKey:@"<$Relationship.name$>"];
<$else$>
<$Relationship.mutableCollectionClassName$> *result = (<$Relationship.mutableCollectionClassName$> *)[self mutableSetValueForKey:@"<$Relationship.name$>"];
<$endif$>
[self didAccessValueForKey:@"<$Relationship.name$>"];
return result;
}
<$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
@dynamic <$FetchedProperty.name$>;
<$endforeach do$>
<$if TemplateVar.frc$>
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors {
NSFetchRequest *fetchRequest = [NSFetchRequest new];
<$if !TemplateVar.arc$>[fetchRequest autorelease];<$endif$>
fetchRequest.entity = [NSEntityDescription entityForName:@"<$Relationship.destinationEntity.name$>" inManagedObjectContext:self.managedObjectContext];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"<$Relationship.inverseRelationship.name$> <$if Relationship.inverseRelationship.isToMany$>CONTAINS<$else$>==<$endif$> %@", self];
fetchRequest.sortDescriptors = sortDescriptors;
<$if indexedNoninheritedAttributes.@count > 0$>
NSArray *indexedIDs = [NSArray arrayWithObjects:<$foreach Attribute indexedNoninheritedAttributes do$>self.<$Attribute.name$>, <$endforeach do$>nil];
NSString *cacheName = [NSString stringWithFormat:@"mogenerator.<$managedObjectClassName$>.%@.<$Relationship.name$>.%@", indexedIDs, sortDescriptors];
<$endif$>
return [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:nil
cacheName:<$if indexedNoninheritedAttributes.@count > 0$>cacheName<$else$>nil<$endif$>];
}
<$endif$>
<$endforeach do$>
#endif
<$endif$>
@end
#pragma mark -
@implementation BUYModelManager (<$managedObjectClassName$>Inserting)
- (<$managedObjectClassName$> *)insert<$name$>WithJSONDictionary:(NSDictionary *)dictionary
{
return (<$managedObjectClassName$> *)[self buy_objectWithEntityName:@"<$name$>" JSONDictionary:dictionary];
}
- (NSArray<<$managedObjectClassName$> *> *)insert<$name$>sWithJSONArray:(NSArray <NSDictionary *> *)array
{
return (NSArray<<$managedObjectClassName$> *> *)[self buy_objectsWithEntityName:@"<$name$>" JSONArray:array];
}
- (NSArray<<$managedObjectClassName$> *> *)all<$name$>Objects
{
return (NSArray<<$managedObjectClassName$> *> *)[self buy_objectsWithEntityName:@"<$name$>" identifiers:nil];
}
- (<$managedObjectClassName$> *)fetch<$name$>WithIdentifierValue:(int64_t)identifier
{
return (<$managedObjectClassName$> *)[self buy_objectWithEntityName:@"<$name$>" identifier:@(identifier)];
}
@end
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Buy/_<$managedObjectClassName$>.h>
@interface <$managedObjectClassName$> : _<$managedObjectClassName$> {}
@end
//
// _<$managedObjectClassName$>.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "<$managedObjectClassName$>.h"
@implementation <$managedObjectClassName$>
@end
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.h instead.
<$if hasCustomSuperentity$><$if hasSuperentity$>#import <Buy/<$customSuperentity$>.h>
<$else$><$if hasCustomBaseCaseImport$>#import <$baseClassImport$><$else$>#import "<$customSuperentity$>.h"<$endif$><$endif$><$endif$>
<$if hasAdditionalHeaderFile$>
#import "<$additionalHeaderFileName$>"
<$endif$>
#import <Buy/BUYModelManager.h>
<$if noninheritedAttributes.@count > 0$>
extern const struct <$managedObjectClassName$>Attributes {<$foreach Attribute noninheritedAttributes do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Attribute.name$>;<$endforeach do$>
} <$managedObjectClassName$>Attributes;
<$endif$>
<$if noninheritedRelationships.@count > 0$>
extern const struct <$managedObjectClassName$>Relationships {<$foreach Relationship noninheritedRelationships do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Relationship.name$>;<$endforeach do$>
} <$managedObjectClassName$>Relationships;
<$endif$>
<$if noninheritedFetchedProperties.@count > 0$>
extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach FetchedProperty noninheritedFetchedProperties do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$FetchedProperty.name$>;<$endforeach do$>
} <$managedObjectClassName$>FetchedProperties;
<$endif$>
<$if hasUserInfoKeys$>
extern const struct <$managedObjectClassName$>UserInfo {<$foreach UserInfo userInfoKeyValues do$>
<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$UserInfo.key$>;<$endforeach do$>
} <$managedObjectClassName$>UserInfo;
<$endif$>
<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$>
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasTransformableAttributeType$><$if Attribute.objectAttributeTransformableProtocols$>
<$foreach Protocol Attribute.objectAttributeTransformableProtocols do$>@protocol <$Protocol$>;
<$endforeach do$><$else$>
@class <$Attribute.objectAttributeClassName$>;<$endif$><$endif$>
<$endforeach do$>
@class <$managedObjectClassName$>;
@interface BUYModelManager (<$managedObjectClassName$>Inserting)
- (NSArray<<$managedObjectClassName$> *> *)all<$name$>Objects;
- (<$managedObjectClassName$> *)fetch<$name$>WithIdentifierValue:(int64_t)identifier;
- (<$managedObjectClassName$> *)insert<$name$>WithJSONDictionary:(NSDictionary *)dictionary;
- (NSArray<<$managedObjectClassName$> *> *)insert<$name$>sWithJSONArray:(NSArray <NSDictionary *> *)array;
@end
<$if userInfo.documentation$>
/**
* <$userInfo.documentation$><$if userInfo.discussion$>
*
* <$userInfo.discussion$><$endif$>
*/<$endif$>
@interface _<$managedObjectClassName$> : <$customSuperentity$>
+ (NSString *)entityName;
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.userInfo.documentation$>
/**
* <$Attribute.userInfo.documentation$><$if Attribute.userInfo.discussion$>
*
* <$Attribute.userInfo.discussion$><$endif$>
*/<$endif$><$if Attribute.hasDefinedAttributeType$><$if TemplateVar.arc$><$if Attribute.isReadonly$>
@property (nonatomic, strong, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, strong) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$else$>
<$if Attribute.isReadonly$>
@property (nonatomic, retain, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, retain) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$endif$>
<$if Attribute.hasScalarAttributeType$>
<$if Attribute.isReadonly$>
@property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
<$else$>
@property (atomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_;
<$endif$><$endif$><$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.userInfo.documentation$>
/**
* <$Relationship.userInfo.documentation$><$if Relationship.userInfo.discussion$>
*
* <$Relationship.userInfo.discussion$><$endif$>
*/<$endif$><$if Relationship.isToMany$><$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$endif$>
- (<$Relationship.mutableCollectionClassName$>*)<$Relationship.name$>Set;
<$else$><$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$endif$><$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
<$if FetchedProperty.userInfo.documentation$>
/**
* <$FetchedProperty.userInfo.documentation$><$if FetchedProperty.userInfo.discussion$>
*
* <$FetchedProperty.userInfo.discussion$><$endif$>
*/<$endif$>
@property (nonatomic, readonly) NSArray *<$FetchedProperty.name$>;
<$endforeach do$>
<$if TemplateVar.frc$>
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors;
<$endif$>
<$endforeach do$>
#endif
<$endif$>
@end
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
@interface _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
<$if Relationship.isOrdered$>
- (void)insertObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value in<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)removeObjectFrom<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)insert<$Relationship.name.initialCapitalString$>:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
- (void)remove<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectIn<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx withObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value;
- (void)replace<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes with<$Relationship.name.initialCapitalString$>:(NSArray *)values;
<$endif$>
@end
<$endif$>
<$endforeach do$>
//
// _<$managedObjectClassName$>.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.m instead.
#import "_<$managedObjectClassName$>.h"
<$if noninheritedAttributes.@count > 0$>
const struct <$managedObjectClassName$>Attributes <$managedObjectClassName$>Attributes = {<$foreach Attribute noninheritedAttributes do$>
.<$Attribute.name$> = @"<$Attribute.name$>",<$endforeach do$>
};
<$endif$>
<$if noninheritedRelationships.@count > 0$>
const struct <$managedObjectClassName$>Relationships <$managedObjectClassName$>Relationships = {<$foreach Relationship noninheritedRelationships do$>
.<$Relationship.name$> = @"<$Relationship.name$>",<$endforeach do$>
};
<$endif$>
<$if noninheritedFetchedProperties.@count > 0$>
const struct <$managedObjectClassName$>FetchedProperties <$managedObjectClassName$>FetchedProperties = {<$foreach FetchedProperty noninheritedFetchedProperties do$>
.<$FetchedProperty.name$> = @"<$FetchedProperty.name$>",<$endforeach do$>
};
<$endif$>
<$if hasUserInfoKeys$>
const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserInfo = {<$foreach UserInfo userInfoKeyValues do$>
.<$UserInfo.key$> = @"<$UserInfo.value$>",<$endforeach do$>
};
<$endif$>
@implementation _<$managedObjectClassName$>
+ (NSString *)entityName {
return @"<$name$>";
}
+ (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];
return keyPaths;
}<$endif$><$endif$><$endforeach do$>
return keyPaths;
}
<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasDefinedAttributeType$>
<$if Attribute.hasScalarAttributeType$>
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value {
NSNumber *result = [self <$Attribute.name$>];
return [result <$Attribute.scalarAccessorMethodName$>];
}
<$if ! Attribute.isReadonly$>
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_ {
[self set<$Attribute.name.initialCapitalString$>:<$if TemplateVar.literals$>@(value_)<$else$>[NSNumber <$Attribute.scalarFactoryMethodName$>value_]<$endif$>];
}
<$endif$>
<$endif$>
<$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (<$Relationship.mutableCollectionClassName$>*)<$Relationship.name$>Set {
<$if Relationship.jr_isOrdered$>
return (<$Relationship.mutableCollectionClassName$>*)[self mutableOrderedSetValueForKey:@"<$Relationship.name$>"];
<$else$>
return (<$Relationship.mutableCollectionClassName$>*)[self mutableSetValueForKey:@"<$Relationship.name$>"];
<$endif$>
}
<$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
@dynamic <$FetchedProperty.name$>;
<$endforeach do$>
<$if TemplateVar.frc$>
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors {
NSFetchRequest *fetchRequest = [NSFetchRequest new];
<$if !TemplateVar.arc$>[fetchRequest autorelease];<$endif$>
fetchRequest.entity = [NSEntityDescription entityForName:@"<$Relationship.destinationEntity.name$>" inManagedObjectContext:self.managedObjectContext];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"<$Relationship.inverseRelationship.name$> <$if Relationship.inverseRelationship.isToMany$>CONTAINS<$else$>==<$endif$> %@", self];
fetchRequest.sortDescriptors = sortDescriptors;
<$if indexedNoninheritedAttributes.@count > 0$>
NSArray *indexedIDs = [NSArray arrayWithObjects:<$foreach Attribute indexedNoninheritedAttributes do$>self.<$Attribute.name$>, <$endforeach do$>nil];
NSString *cacheName = [NSString stringWithFormat:@"mogenerator.<$managedObjectClassName$>.%@.<$Relationship.name$>.%@", indexedIDs, sortDescriptors];
<$endif$>
return [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:nil
cacheName:<$if indexedNoninheritedAttributes.@count > 0$>cacheName<$else$>nil<$endif$>];
}
<$endif$>
<$endforeach do$>
#endif
<$endif$>
@end
<$foreach Relationship noninheritedRelationships do$><$if Relationship.isToMany$><$if Relationship.jr_isOrdered$>
@implementation _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
- (void)insertObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value in<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx {
NSIndexSet* indexes = [NSIndexSet indexSetWithIndex:idx];
[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet insertObject:value atIndex:idx];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
- (void)removeObjectFrom<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx {
NSIndexSet* indexes = [NSIndexSet indexSetWithIndex:idx];
[self willChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet removeObjectAtIndex:idx];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
- (void)insert<$Relationship.name.initialCapitalString$>:(NSArray *)value atIndexes:(NSIndexSet *)indexes {
[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet insertObjects:value atIndexes:indexes];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
- (void)remove<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes {
[self willChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet removeObjectsAtIndexes:indexes];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeRemoval valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
- (void)replaceObjectIn<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx withObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value {
NSIndexSet* indexes = [NSIndexSet indexSetWithIndex:idx];
[self willChange:NSKeyValueChangeReplacement valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet replaceObjectAtIndex:idx withObject:value];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeReplacement valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
- (void)replace<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes with<$Relationship.name.initialCapitalString$>:(NSArray *)value {
[self willChange:NSKeyValueChangeReplacement valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
NSMutableOrderedSet *tmpOrderedSet = [NSMutableOrderedSet orderedSetWithOrderedSet:[self <$Relationship.name$>]];
[tmpOrderedSet replaceObjectsAtIndexes:indexes withObjects:value];
[self setValue:tmpOrderedSet forKey:@"<$Relationship.name$>"];
[self didChange:NSKeyValueChangeReplacement valuesAtIndexes:indexes forKey:@"<$Relationship.name$>"];
}
@end
<$endif$><$endif$><$endforeach do$>
#pragma mark -
@implementation BUYModelManager (<$managedObjectClassName$>Inserting)
- (<$managedObjectClassName$> *)insert<$name$>WithJSONDictionary:(NSDictionary *)dictionary
{
return (<$managedObjectClassName$> *)[self buy_objectWithEntityName:@"<$name$>" JSONDictionary:dictionary];
}
- (NSArray<<$managedObjectClassName$> *> *)insert<$name$>sWithJSONArray:(NSArray <NSDictionary *> *)array
{
return (NSArray<<$managedObjectClassName$> *> *)[self buy_objectsWithEntityName:@"<$name$>" JSONArray:array];
}
- (NSArray<<$managedObjectClassName$> *> *)all<$name$>Objects
{
return (NSArray<<$managedObjectClassName$> *> *)[self buy_objectsWithEntityName:@"<$name$>" identifiers:nil];
}
- (<$managedObjectClassName$> *)fetch<$name$>WithIdentifierValue:(int64_t)identifier
{
return (<$managedObjectClassName$> *)[self buy_objectWithEntityName:@"<$name$>" identifier:@(identifier)];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment