mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-06 09:41:09 +08:00
Apply rootKeyPath within the mapper rather than the object loader
This commit is contained in:
@@ -214,10 +214,9 @@
|
||||
|
||||
RKObjectMappingProvider* mappingProvider;
|
||||
RKObjectMapping *configuredObjectMapping = [self configuredObjectMapping];
|
||||
if (configuredObjectMapping) {
|
||||
NSString* rootKeyPath = configuredObjectMapping.rootKeyPath ? configuredObjectMapping.rootKeyPath : @"";
|
||||
RKLogDebug(@"Found directly configured object mapping, creating temporary mapping provider for keyPath %@", rootKeyPath);
|
||||
if (configuredObjectMapping) {
|
||||
mappingProvider = [RKObjectMappingProvider mappingProvider];
|
||||
NSString *rootKeyPath = configuredObjectMapping.rootKeyPath ? configuredObjectMapping.rootKeyPath : @"";
|
||||
[mappingProvider setMapping:configuredObjectMapping forKeyPath:rootKeyPath];
|
||||
} else {
|
||||
RKLogDebug(@"No object mapping provider, using mapping provider from parent object manager to perform KVC mapping");
|
||||
|
||||
@@ -334,7 +334,9 @@
|
||||
} else if ([mappingsForContext conformsToProtocol:@protocol(RKObjectMappingDefinition)]) {
|
||||
id mappableData = self.sourceObject;
|
||||
if ([mappingsForContext respondsToSelector:@selector(rootKeyPath)] && [mappingsForContext rootKeyPath] != nil) {
|
||||
mappableData = [self.sourceObject valueForKeyPath:[mappingsForContext rootKeyPath]];
|
||||
NSString* rootKeyPath = [mappingsForContext rootKeyPath];
|
||||
mappableData = [self.sourceObject valueForKeyPath:rootKeyPath];
|
||||
RKLogDebug(@"Selected object mapping has rootKeyPath. Apply valueForKeyPath to mappable data: %@", rootKeyPath);
|
||||
}
|
||||
|
||||
if (mappableData) {
|
||||
|
||||
Reference in New Issue
Block a user