mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-22 20:18:53 +08:00
Integrated support and test coverage for mapping relationships onto NSOrderedSet values. closes #578
This commit is contained in:
@@ -530,6 +530,7 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
|
||||
// If the relationship has changed, set it
|
||||
if ([self shouldSetValue:&destinationObject atKeyPath:relationshipMapping.destinationKeyPath]) {
|
||||
Class managedObjectClass = NSClassFromString(@"NSManagedObject");
|
||||
Class nsOrderSetClass = NSClassFromString(@"NSOrderedSet");
|
||||
if (managedObjectClass && [self.destinationObject isKindOfClass:managedObjectClass]) {
|
||||
RKLogTrace(@"Found a managedObject collection. About to apply value via mutable[Set|Array]ValueForKey");
|
||||
if ([destinationObject isKindOfClass:[NSSet class]]) {
|
||||
@@ -540,6 +541,9 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
|
||||
RKLogTrace(@"Mapped NSArray relationship object from keyPath '%@' to '%@'. Value: %@", relationshipMapping.sourceKeyPath, relationshipMapping.destinationKeyPath, destinationObject);
|
||||
NSMutableArray* destinationArray = [self.destinationObject mutableArrayValueForKey:relationshipMapping.destinationKeyPath];
|
||||
[destinationArray setArray:destinationObject];
|
||||
} else if (nsOrderSetClass && [destinationObject isKindOfClass:nsOrderSetClass]) {
|
||||
RKLogTrace(@"Mapped NSOrderedSet relationship object from keyPath '%@' to '%@'. Value: %@", relationshipMapping.sourceKeyPath, relationshipMapping.destinationKeyPath, destinationObject);
|
||||
[self.destinationObject setValue:destinationObject forKey:relationshipMapping.destinationKeyPath];
|
||||
}
|
||||
} else {
|
||||
RKLogTrace(@"Mapped relationship object from keyPath '%@' to '%@'. Value: %@", relationshipMapping.sourceKeyPath, relationshipMapping.destinationKeyPath, destinationObject);
|
||||
|
||||
Reference in New Issue
Block a user