Skip to content

Commit

Permalink
Merge branch 'null-relationship' of https://github.com/Sigmapoint/Mag…
Browse files Browse the repository at this point in the history
…icalRecord into Sigmapoint-null-relationship
  • Loading branch information
Coeur committed Jun 21, 2019
2 parents b91e55b + 990d68f commit ad79e25
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ - (void)MR_setRelationships:(NSDictionary *)relationships forKeysWithObject:(id)
}
@finally
{
if (relatedObjectData == nil || [relatedObjectData isEqual:[NSNull null]])
if (relatedObjectData == nil)
{
continue;
}
Expand All @@ -210,6 +210,12 @@ - (void)MR_setRelationships:(NSDictionary *)relationships forKeysWithObject:(id)
continue;
}

if ([relatedObjectData isEqual:[NSNull null]])
{
[self setValue:nil forKey:relationshipName];
continue;
}

if ([relationshipInfo isToMany] && [relatedObjectData isKindOfClass:[NSArray class]])
{
for (id singleRelatedObjectData in relatedObjectData)
Expand Down

0 comments on commit ad79e25

Please sign in to comment.