Add support for sending objects of one type and getting back another. Target object has been disambiguated into sourceObject and targetObject

and act independently with regards to serialization and destination mapping. When you leverage the getObject:mapResponseWith: flavor of methods,
the type of your sourceObject is checked with the destination type of the object mapping. If they agree, it is assumed that you are trying to update
the object with the results of the mapping and targetObject is set appropriately. If they do not match, the targetObject is set to nil so that new
objects will be loaded. closes #161, #168
This commit is contained in:
Blake Watters
2011-06-30 10:32:44 -04:00
parent 2ac45f5ccc
commit 7053a8ca97
6 changed files with 111 additions and 18 deletions

View File

@@ -79,9 +79,10 @@
RKObjectManager* _objectManager;
RKResponse* _response;
RKObjectMapping* _objectMapping;
RKObjectMappingResult* _result;
RKObjectMappingResult* _result;
RKObjectMapping* _serializationMapping;
NSString* _serializationMIMEType;
NSString* _serializationMIMEType;
NSObject* _sourceObject;
NSObject* _targetObject;
}
@@ -136,8 +137,17 @@
@property (nonatomic, retain) NSString* serializationMIMEType;
/**
* The mappable object that generated this loader. This is used to map object
* updates back to the object that sent the request
The object being serialized for transport. This object will be transformed into a
serialization in the serializationMIMEType using the serializationMapping.
@see RKObjectSerializer
*/
@property (nonatomic, retain) NSObject* sourceObject;
/**
* The target object to map results back onto. If nil, a new object instance
* for the appropriate mapping will be created. If not nil, the results will
* be used to update the targetObject's attributes and relationships.
*/
@property (nonatomic, retain) NSObject* targetObject;