Skip to content

Instantly share code, notes, and snippets.

@whalec
Created March 13, 2011 02:49
Show Gist options
  • Save whalec/867827 to your computer and use it in GitHub Desktop.
Save whalec/867827 to your computer and use it in GitHub Desktop.
@implementation InspectionFollowupDateToPropertyMigration
- (BOOL)createRelationshipsForDestinationInstance:(NSManagedObject *)source entityMapping:(NSEntityMapping *)mapping
manager:(NSMigrationManager *)manager error:(NSError **)error
{
NSMutableSet *inspections = [source valueForKey:@"inspections"];
for (id inspection in inspections)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDate *inspectionDate = [inspection valueForKey:@"followupNextDueDate"];
if (inspectionDate != nil)
{
[source setValue:inspectionDate forKey:@"followUpNextDueDate"];
}
[pool drain];
}
return [super createRelationshipsForDestinationInstance:source entityMapping:mapping manager:manager error:error];;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment