-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-96 Add Chat and Message mappings for recursive tests
- Loading branch information
Dima Zen
committed
May 20, 2017
1 parent
489a2d1
commit 3bc5082
Showing
8 changed files
with
112 additions
and
18 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,12 @@ | ||
// For License please refer to LICENSE file in the root of FastEasyMapping project | ||
|
||
#import "Chat+CoreDataClass.h" | ||
|
||
@class FEMMapping; | ||
|
||
@interface Chat (Mapping) | ||
|
||
+ (FEMMapping *)defaultMapping; | ||
+ (FEMMapping *)recursiveMapping; | ||
|
||
@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 @@ | ||
// For License please refer to LICENSE file in the root of FastEasyMapping project | ||
|
||
#import "Chat+Mapping.h" | ||
#import "ChatMessage+Mapping.h" | ||
|
||
@import FastEasyMapping; | ||
|
||
@implementation Chat (Mapping) | ||
|
||
+ (FEMMapping *)defaultMapping { | ||
FEMMapping *mapping = [[FEMMapping alloc] initWithEntityName:NSStringFromClass(self)]; | ||
mapping.primaryKey = @"primaryKey"; | ||
[mapping addAttributesFromArray:@[@"primaryKey"]]; | ||
|
||
return mapping; | ||
} | ||
|
||
+ (FEMMapping *)recursiveMapping { | ||
FEMMapping *chat = [self defaultMapping]; | ||
|
||
FEMMapping *message = [ChatMessage defaultMapping]; | ||
[message addRelationshipMapping:[Chat defaultMapping] forProperty:@"chat" keyPath:@"chat"]; | ||
|
||
[chat addToManyRelationshipMapping:message forProperty:@"messages" keyPath:@"messages"]; | ||
|
||
return chat; | ||
} | ||
|
||
@end |
11 changes: 11 additions & 0 deletions
11
FastEasyMappingTests/Mapping Provider/ChatMessage+Mapping.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,11 @@ | ||
// For License please refer to LICENSE file in the root of FastEasyMapping project | ||
|
||
#import "ChatMessage+CoreDataClass.h" | ||
|
||
@class FEMMapping; | ||
|
||
@interface ChatMessage (Mapping) | ||
|
||
+ (FEMMapping *)defaultMapping; | ||
|
||
@end |
16 changes: 16 additions & 0 deletions
16
FastEasyMappingTests/Mapping Provider/ChatMessage+Mapping.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,16 @@ | ||
// For License please refer to LICENSE file in the root of FastEasyMapping project | ||
|
||
#import "ChatMessage+Mapping.h" | ||
|
||
@import FastEasyMapping; | ||
|
||
@implementation ChatMessage (Mapping) | ||
|
||
+ (FEMMapping *)defaultMapping { | ||
FEMMapping *mapping = [[FEMMapping alloc] initWithEntityName:NSStringFromClass(self)]; | ||
mapping.primaryKey = @"primaryKey"; | ||
[mapping addAttributesFromArray:@[@"primaryKey"]]; | ||
return mapping; | ||
} | ||
|
||
@end |
File renamed without changes.
File renamed without changes.
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