Files
RestKit/Examples/RKDiscussionBoardExample/DiscussionBoard/Code/Models/DBTopic.m
Blake Watters f3c0995d5e Implementation of Object Mapping 2.0 design:
* 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
2011-06-11 19:26:56 -04:00

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