source: branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMoviePoster.m @ 734

Revision 734, 1.0 KB checked in by gbooker, 6 years ago (diff)

Switched the the next version of the metadata.
Fixes #264

Line 
1#import "SapphireMoviePoster.h"
2
3@implementation SapphireMoviePoster
4
5+ (SapphireMoviePoster *)createPosterWithLink:(NSString *)link index:(int)index translation:(SapphireMovieTranslation *)translation inContext:(NSManagedObjectContext *)moc
6{
7        SapphireMoviePoster *ret = [NSEntityDescription insertNewObjectForEntityForName:SapphireMoviePosterName inManagedObjectContext:moc];
8        ret.link = link;
9        ret.indexValue = index;
10        ret.movieTranslation = translation;
11       
12        return ret;
13}
14
15+ (SapphireMoviePoster *)upgradeV1MoviePoster:(NSManagedObject *)oldTran toTranslation:(SapphireMovieTranslation *)translation
16{
17        NSManagedObjectContext *newMoc = [translation managedObjectContext];
18        SapphireMoviePoster *ret = [NSEntityDescription insertNewObjectForEntityForName:SapphireMoviePosterName inManagedObjectContext:newMoc];
19        ret.link = [oldTran valueForKey:@"link"];
20        ret.index = [oldTran valueForKey:@"index"];
21        ret.movieTranslation = translation;
22        return ret;
23}
24
25- (NSComparisonResult)compare:(SapphireMoviePoster *)other
26{
27        return [self.index compare:other.index];
28}
29
30@end
Note: See TracBrowser for help on using the repository browser.