Skip to content

Commit 54ddfa5

Browse files
committed
Fixes #15: failed assertion 'relationship': fetch requests with substitution variables. Tests passing.
1 parent a9b8f31 commit 54ddfa5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

mogenerator.m

+8-3
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,14 @@ - (NSString*)_resolveKeyPathType:(NSString*)keyPath {
186186

187187
NSEntityDescription *entity = self;
188188
nsenumerate(components, NSString, key) {
189-
NSRelationshipDescription *relationship = [[entity relationshipsByName] objectForKey:key];
190-
assert(relationship);
191-
entity = [relationship destinationEntity];
189+
id property = [[entity propertiesByName] objectForKey:key];
190+
if ([property isKindOfClass:[NSAttributeDescription class]]) {
191+
NSString *result = [property objectAttributeType];
192+
return [result substringToIndex:[result length] -1];
193+
} else if ([property isKindOfClass:[NSRelationshipDescription class]]) {
194+
entity = [property destinationEntity];
195+
}
196+
assert(property);
192197
}
193198

194199
return [entity managedObjectClassName];

test/test.xcdatamodel/elements

111 Bytes
Binary file not shown.

test/test.xcdatamodel/layout

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)