RestKit/RestKit — Issue #512: Support Compound primaryKey
Author: srlake
Created: 2012-01-20 05:04:43+00:00
State: open

Support for compound primaryKey's is desirable for use when no unique key is present in data. For example, when multiple top level objects may own their own copies of lower-level objects with identical id's.

Current method of achieving this functionality is outlined here: https://github.com/RestKit/RestKit/wiki/Create-and-Inject-Custom-Objects-For-Complex-Core-Data-Relations

If this could be supported directly when configuring object mapping, it would make the process much simple. For example:
RKManagedObjectMapping *bookMapping = [RKManagedObjectMapping mappingForClass:[Book class]];
[bookMapping setPrimaryKeyAttributes:@"owner",@"title",nil];

Which would configure the mapper to inspect for both keys to be matching before deletion, etc.

This was also request here: https://github.com/RestKit/RestKit/issues/419