Docs for RKRelationshipMapping

This commit is contained in:
Blake Watters
2012-09-19 23:18:20 -04:00
parent 991ced34da
commit 56e71e9dac

View File

@@ -22,10 +22,35 @@
@class RKMapping;
/**
The `RKRelationshipMapping` class is used to describe relationships of a class in an `RKObjectMapping` or an entity in an `RKEntityMapping` object.
`RKRelationshipMapping` extends `RKPropertyMapping` to describe features specific to relationships, including the `RKMapping` object describing how to map the destination object.
*/
@interface RKRelationshipMapping : RKPropertyMapping
@property (nonatomic, strong, readonly) RKMapping *mapping;
///--------------------------------------
/// @name Creating a Relationship Mapping
///--------------------------------------
/**
Creates and returns a new relationship mapping object describing how to transform a related object representation at `sourceKeyPath` to a new representation at `destinationKeyPath` using the given mapping.
The mapping may describe a to-one or a to-many relationship. The appropriate handling of the source representation is deferred until run-time and is determined by performing reflection on the data retrieved from the source object representation by sending a `valueForKeyPath:` message where the key path is the value given in `sourceKeyPath`. If an `NSArray`, `NSSet` or `NSOrderedSet` object is returned, the related object representation is processed as a to-many collection. Otherwise the representation is considered to be a to-one.
@param sourceKeyPath A key path from which to retrieve data in the source object representation that is to be mapped as a relationship.
@param destinationKeyPath The key path on the destination object to set the object mapped results.
@param mapping A mapping object describing how to map the data retrieved from `sourceKeyPath` that is to be set on `destinationKeyPath`.
*/
+ (RKRelationshipMapping *)relationshipMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath withMapping:(RKMapping *)mapping;
///----------------------------------------
/// @name Accessing the Destination Mapping
///----------------------------------------
/**
An `RKMapping` object describing how to map the object representation at `sourceKeyPath` to a new represenation at `destinationKeyPath`.
*/
@property (nonatomic, strong, readonly) RKMapping *mapping;
@end