-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from rhodgkins/issue112
Relationships do not create the correct sub-entity
- Loading branch information
Showing
30 changed files
with
1,316 additions
and
932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
exampleProjects/IncrementalStore/ClassModel.xcdatamodeld/ClassModel.xcdatamodel/contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="5064" systemVersion="13E28" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> | ||
<entity name="ChildA" representedClassName="ISDChildA" parentEntity="Parent" syncable="YES"> | ||
<attribute name="attributeA" optional="YES" attributeType="String" syncable="YES"/> | ||
</entity> | ||
<entity name="ChildB" representedClassName="ISDChildB" parentEntity="Parent" syncable="YES"> | ||
<attribute name="attributeB" optional="YES" attributeType="String" syncable="YES"/> | ||
</entity> | ||
<entity name="Parent" representedClassName="ISDParent" isAbstract="YES" syncable="YES"> | ||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/> | ||
<relationship name="manyToManyInverse" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Root" inverseName="manyToMany" inverseEntity="Root" syncable="YES"/> | ||
<relationship name="oneToManyInverse" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Root" inverseName="oneToMany" inverseEntity="Root" syncable="YES"/> | ||
<relationship name="oneToOneInverse" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Root" inverseName="oneToOne" inverseEntity="Root" syncable="YES"/> | ||
</entity> | ||
<entity name="Root" representedClassName="ISDRoot" syncable="YES"> | ||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/> | ||
<relationship name="manyToMany" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Parent" inverseName="manyToManyInverse" inverseEntity="Parent" syncable="YES"/> | ||
<relationship name="oneToMany" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Parent" inverseName="oneToManyInverse" inverseEntity="Parent" syncable="YES"/> | ||
<relationship name="oneToOne" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="Parent" inverseName="oneToOneInverse" inverseEntity="Parent" syncable="YES"/> | ||
</entity> | ||
<elements> | ||
<element name="ChildA" positionX="-119" positionY="144" width="128" height="58"/> | ||
<element name="ChildB" positionX="79" positionY="144" width="128" height="58"/> | ||
<element name="Parent" positionX="-20" positionY="8" width="128" height="103"/> | ||
<element name="Root" positionX="-236" positionY="8" width="128" height="103"/> | ||
</elements> | ||
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ISDChildA.h | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreData/CoreData.h> | ||
#import "ISDParent.h" | ||
|
||
|
||
@interface ISDChildA : ISDParent | ||
|
||
@property (nonatomic, retain) NSString * attributeA; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// ISDChildA.m | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import "ISDChildA.h" | ||
|
||
|
||
@implementation ISDChildA | ||
|
||
@dynamic attributeA; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ISDChildB.h | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreData/CoreData.h> | ||
#import "ISDParent.h" | ||
|
||
|
||
@interface ISDChildB : ISDParent | ||
|
||
@property (nonatomic, retain) NSString * attributeB; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// ISDChildB.m | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import "ISDChildB.h" | ||
|
||
|
||
@implementation ISDChildB | ||
|
||
@dynamic attributeB; | ||
|
||
@end |
19 changes: 19 additions & 0 deletions
19
exampleProjects/IncrementalStore/ClassModels/ISDModelCategories.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// ISDModelCategories.h | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import <CoreData/CoreData.h> | ||
|
||
@interface NSManagedObject (ISDHelper) | ||
|
||
+(NSString *)entityName; | ||
|
||
+(instancetype)insertInManagedObjectContext:(NSManagedObjectContext *)context; | ||
|
||
+(NSFetchRequest *)fetchRequest; | ||
|
||
@end |
60 changes: 60 additions & 0 deletions
60
exampleProjects/IncrementalStore/ClassModels/ISDModelCategories.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// ISDModelCategories.m | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import "ISDModelCategories.h" | ||
|
||
#import "ISDRoot.h" | ||
#import "ISDParent.h" | ||
#import "ISDChildA.h" | ||
#import "ISDChildB.h" | ||
|
||
@implementation NSManagedObject (ISDHelper) | ||
|
||
+(NSString *)entityName | ||
{ | ||
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Override in subclasses" userInfo:nil]; | ||
} | ||
|
||
+(instancetype)insertInManagedObjectContext:(NSManagedObjectContext *)context | ||
{ | ||
return [NSEntityDescription insertNewObjectForEntityForName:[self entityName] inManagedObjectContext:context]; | ||
} | ||
|
||
+(NSFetchRequest *)fetchRequest | ||
{ | ||
return [NSFetchRequest fetchRequestWithEntityName:[self entityName]]; | ||
} | ||
|
||
@end | ||
|
||
@implementation ISDRoot (ISDHelper) | ||
|
||
+(NSString *)entityName | ||
{ | ||
return @"Root"; | ||
} | ||
|
||
@end | ||
|
||
@implementation ISDChildA (ISDHelper) | ||
|
||
+(NSString *)entityName | ||
{ | ||
return @"ChildA"; | ||
} | ||
|
||
@end | ||
|
||
@implementation ISDChildB (ISDHelper) | ||
|
||
+(NSString *)entityName | ||
{ | ||
return @"ChildB"; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// ISDParent.h | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreData/CoreData.h> | ||
|
||
@class ISDRoot; | ||
|
||
@interface ISDParent : NSManagedObject | ||
|
||
@property (nonatomic, retain) NSString * name; | ||
@property (nonatomic, retain) ISDRoot *oneToManyInverse; | ||
@property (nonatomic, retain) ISDRoot *oneToOneInverse; | ||
@property (nonatomic, retain) NSSet *manyToManyInverse; | ||
@end | ||
|
||
@interface ISDParent (CoreDataGeneratedAccessors) | ||
|
||
- (void)addManyToManyInverseObject:(ISDRoot *)value; | ||
- (void)removeManyToManyInverseObject:(ISDRoot *)value; | ||
- (void)addManyToManyInverse:(NSSet *)values; | ||
- (void)removeManyToManyInverse:(NSSet *)values; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ISDParent.m | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import "ISDParent.h" | ||
#import "ISDRoot.h" | ||
|
||
|
||
@implementation ISDParent | ||
|
||
@dynamic name; | ||
@dynamic oneToManyInverse; | ||
@dynamic oneToOneInverse; | ||
@dynamic manyToManyInverse; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// ISDRoot.h | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreData/CoreData.h> | ||
|
||
@class ISDParent; | ||
|
||
@interface ISDRoot : NSManagedObject | ||
|
||
@property (nonatomic, retain) NSString * name; | ||
@property (nonatomic, retain) NSSet *oneToMany; | ||
@property (nonatomic, retain) ISDParent *oneToOne; | ||
@property (nonatomic, retain) NSSet *manyToMany; | ||
@end | ||
|
||
@interface ISDRoot (CoreDataGeneratedAccessors) | ||
|
||
- (void)addOneToManyObject:(ISDParent *)value; | ||
- (void)removeOneToManyObject:(ISDParent *)value; | ||
- (void)addOneToMany:(NSSet *)values; | ||
- (void)removeOneToMany:(NSSet *)values; | ||
|
||
- (void)addManyToManyObject:(ISDParent *)value; | ||
- (void)removeManyToManyObject:(ISDParent *)value; | ||
- (void)addManyToMany:(NSSet *)values; | ||
- (void)removeManyToMany:(NSSet *)values; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ISDRoot.m | ||
// Incremental Store | ||
// | ||
// Created by Richard Hodgkins on 31/08/2014. | ||
// Copyright (c) 2014 Caleb Davenport. All rights reserved. | ||
// | ||
|
||
#import "ISDRoot.h" | ||
#import "ISDParent.h" | ||
|
||
|
||
@implementation ISDRoot | ||
|
||
@dynamic name; | ||
@dynamic oneToMany; | ||
@dynamic oneToOne; | ||
@dynamic manyToMany; | ||
|
||
@end |
38 changes: 38 additions & 0 deletions
38
.../IncrementalStore/Incremental Store Demo/Images.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "1x", | ||
"size" : "57x57" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "57x57" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ementalStore/Incremental Store Demo/Images.xcassets/LaunchImage.launchimage/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"minimum-system-version" : "7.0", | ||
"subtype" : "retina4", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "1x", | ||
"orientation" : "portrait" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"orientation" : "portrait" | ||
}, | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"subtype" : "retina4", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"minimum-system-version" : "7.0", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.