Skip to content

Commit

Permalink
Fixes rentzsch#15: failed assertion 'relationship': fetch requests wi…
Browse files Browse the repository at this point in the history
…th substitution variables. Tests passing.
  • Loading branch information
rentzsch committed Jan 14, 2013
1 parent 0b3b0e2 commit a9b1441
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,14 @@ - (NSString*)_resolveKeyPathType:(NSString*)keyPath {

NSEntityDescription *entity = self;
nsenumerate(components, NSString, key) {
NSRelationshipDescription *relationship = [[entity relationshipsByName] objectForKey:key];
assert(relationship);
entity = [relationship destinationEntity];
id property = [[entity propertiesByName] objectForKey:key];
if ([property isKindOfClass:[NSAttributeDescription class]]) {
NSString *result = [property objectAttributeType];
return [result substringToIndex:[result length] -1];
} else if ([property isKindOfClass:[NSRelationshipDescription class]]) {
entity = [property destinationEntity];
}
assert(property);
}

return [entity managedObjectClassName];
Expand Down
Binary file modified test/test.xcdatamodel/elements
Binary file not shown.
Binary file modified test/test.xcdatamodel/layout
Binary file not shown.

0 comments on commit a9b1441

Please sign in to comment.