Add support for the use of nesting key attributes as the primaryKey in managed mappings.

This bug was causing duplication of objects in the store due to failed lookup of
existing objects. Added fix and test coverage for the use-case.
This commit is contained in:
Blake Watters
2011-10-05 10:50:52 -04:00
parent a4d84aadf3
commit 586034bae4
9 changed files with 86 additions and 26 deletions

View File

@@ -240,7 +240,7 @@ relationship. Relationships are processed using an object mapping as well.
@param attributeKey The name of the attribute we want to retrieve the mapping for
*/
- (RKObjectAttributeMapping*)mappingForAttribute:(NSString*)attributeKey;
- (RKObjectAttributeMapping *)mappingForAttribute:(NSString *)attributeKey;
/**
Returns the relationship mapping targeting the specified relationship on the destination object
@@ -424,7 +424,16 @@ relationship. Relationships are processed using an object mapping as well.
[[RKObjectManager sharedManager].mappingProvider setObjectMapping:mapping forKeyPath:@"users"];
*/
- (void)mapKeyOfNestedDictionaryToAttribute:(NSString*)attributeName;
- (void)mapKeyOfNestedDictionaryToAttribute:(NSString *)attributeName;
/**
Returns the attribute mapping targeting the key of a nested dictionary in the source JSON.
This attribute mapping corresponds to the attributeName configured via mapKeyOfNestedDictionaryToAttribute:
@see mapKeyOfNestedDictionaryToAttribute:
@returns An attribute mapping for the key of a nested dictionary being mapped or nil
*/
- (RKObjectAttributeMapping *)attributeMappingForKeyOfNestedDictionary;
/**
Removes all currently configured attribute and relationship mappings from the object mapping