github/Mantle — pull request #183 by rex-remind101 (2013-11-12 21:06:04+00:00)
Title: Value collection to relationship

Hey guys, got a new one for you!

This pull request allows for MTLManagedObjectAdaptor to perform a fetch request when serializing a to-many relationship from a collection of values.

Previously, if JSON came over the wire in the following form when retrieving an object:
{
id = 3,
children = [4, 7, 8, 29, 100]
}

I couldn't figure out a way to fetch children by their identifiers when serializing the object via MTLManagedObjectAdaptor.

So I built in a new method `+ (NSDictionary *)managedObjectCollectionDescriptionForKey:(NSString *)key;` which can also be used by the MTLModel property key pointing to the relationship `+ (NSDictionary *)childrenManagedObjectCollectionDescription` to define an instance where a collection of values should be used to fetch existing objects for a relationship.

I'm excited to hear what you guys think!