Skip to content

Instantly share code, notes, and snippets.

@gunnarblom
Last active Dec 17, 2015
Embed
What would you like to do?
Sharing parent value when mapping a list of objects
// {
// "category": "MyCategory"
// "items": [
// { "id": 1, "name": "A" },
// { "id": 2, "name": "B" },
// { "id": 3, "name": "C" }
// ]
// }
// Current mapping, but missing "category" object that should be mapped to each "Item"
RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:@"Item" inManagedObjectStore:manager.managedObjectStore];
mapping.identificationAttributes = @[ @"id" ];
[mapping addAttributeMappingsFromDictionary:@{ @"name": @"name" }];
// TODO: Also add "category" to this mapping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment