mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-02 17:57:22 +08:00
* Removed RestKit from inheritance hierarchy * Mappings are implemented as concrete classes * Mapper is much more flexible & powerful * Much more robust error handling * Serialization is reimplemented as an object mapping operation * Added ability to serialize to JSON natively * Reworked Core Data integration * Simplified the codebase substantially
44 lines
1.1 KiB
Objective-C
44 lines
1.1 KiB
Objective-C
//
|
|
// DBTopic.m
|
|
// DiscussionBoard
|
|
//
|
|
// Created by Daniel Hammond on 1/7/11.
|
|
// Copyright 2011 Two Toasters. All rights reserved.
|
|
//
|
|
|
|
#import "DBTopic.h"
|
|
|
|
@implementation DBTopic
|
|
|
|
@dynamic topicID;
|
|
@dynamic name;
|
|
@dynamic posts;
|
|
|
|
#pragma mark RKObjectMappable methods
|
|
|
|
/**
|
|
* Informs RestKit which properties contain the primary key values that
|
|
* can be used to hydrate relationships to other objects. This hint enables
|
|
* RestKit to automatically maintain true Core Data relationships between objects
|
|
* in your local store.
|
|
*
|
|
* Here we have asked RestKit to connect the 'user' relationship by performing a
|
|
* primary key lookup with the value in 'userID' property. This is the declarative
|
|
* equivalent of doing self.user = [DBUser objectWithPrimaryKeyValue:self.userID];
|
|
*/
|
|
+ (NSDictionary*)relationshipToPrimaryKeyPropertyMappings {
|
|
return [NSDictionary dictionaryWithKeysAndObjects:
|
|
@"user", @"userID",
|
|
nil];
|
|
}
|
|
|
|
/**
|
|
* Informs RestKit which property contains the primary key for identifying
|
|
* this object. This is used to ensure that objects are updated
|
|
*/
|
|
+ (NSString*)primaryKeyProperty {
|
|
return @"topicID";
|
|
}
|
|
|
|
@end
|