I have two entities from two different web services which have a many to many relationship.
entity A { NSString *id, NSString *details }
entity B { NSString *key, NSString *value, NSString *type, NSString *foreignId }
and I try to map the entity B :
+ (RKObjectMapping *)mapping { RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:NSStringFromClass([self class]) inManagedObjectStore:[RKObjectManager sharedManager].managedObjectStore];
[mapping addAttributeMappingsFromDictionary:@{
@"key": @"key",
@"id":@"foreignId",
@"type":@"type",
@"value":@"value"
}];
mapping.identificationAttributes = @[@"featureKey",@"type",@"foreignID"];
[mapping addConnectionForRelationship:@"homeApplianceDatas" connectedBy:@{@"foreignId":@"id"}];
return mapping;
}
In my test json all entities of type B have the same foreignID "Car" but only a few of them get a relation to an "A" entity (about 15%) !!!
Any Idea?