RKConnectionMapping Class Reference
| Inherits from | RKPropertyMapping : NSObject |
| Declared in | RKConnectionMapping.h |
Overview
Conditionally connect a relationship of the object being mapped when the object being mapped has block evaluate to YES. This variant is useful in cases where you want to execute an arbitrary block to determine whether or not to connect a relationship.
For example, given a Project object associated with a User, where the ‘admin’ relationship is specified by a adminID property on the managed object:
[mapping connectRelationship:@“admin” fromKeyPath:@“adminId” toKeyPath:@“adminID” withMapping:userMapping usingEvaluationBlock:^(id data) { return [User isAuthenticated]; }];
Will hydrate the ‘admin’ association on the managed object with the object in the local object graph having the primary key specified in the managed object’s userID property. Note that this connection will only occur when the provided block evalutes to YES. In cases where no match occurs, the relationship connection is skipped.
Instance Methods
initWithRelationship:sourceKeyPath:destinationKeyPath:matcher:
**
- (id)initWithRelationship:(NSRelationshipDescription *)relationship sourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath matcher:(RKDynamicMappingMatcher *)matcherDeclared In
RKConnectionMapping.h