RestKit/RestKit — pull request #1309 by percysnoodle (2013-04-02 13:53:33+00:00)
Title: Support additional objects when mapping a target object

Our API allows us to update Issues. Issues refer to Users in several places, so the endpoint returns objects like this:

```json
{
"issue" : {
"raisedByUserId" : 123,
"assignedToUserId" : 456,
"involvedUserIds" : [ 456, 789 ]
},
"users" : {
{ "id" : 123, "name" : "User 123" },
{ "id" : 456, "name" : "User 456" },
{ "id" : 789, "name" : "User 789" },
}
}
```

We then have mappings for Issues and Users, with connections from Issue to User set up like so:

```objective-c
[mapping addConnectionForRelationship:@"assignedToUser" connectedBy:@{ @"assignedToUserId" : @"id" }];
[mapping addConnectionForRelationship:@"raisedByUser" connectedBy:@{ @"raisedByUserId" : @"id" }];
[mapping addConnectionForRelationship:@"involvedUsers" connectedBy:@{ @"involvedUserIds" : @"id" }];
```

This works fine for GETs, but when POSTing a new issue we get the `Cannot map a collection of objects onto a non-mutable collection` error. To work around this, this pull request changes RKMapperOperation so that it only tries to map the target object if the mapping's object class matches. This allows us to send unrelated objects at the same time, and the connection works as expected.