This project uses Mogenerator and Magical Record. I have tracked down a bug to the fact that awakeFromInsert
is getting called twice. Once for each of my contexts I
here is the simplest one: when parentContext is null, means when this context is saved you can do you custom logic, for example incrementing table number
- (void)awakeFromInsert
{
if (!self.managedObjectContext.parentContext) {
//setting tableNumber
[self willChangeValueForKey:@"number"];
[self setPrimitiveNumber:tableNumber];
[self didChangeValueForKey:@"number"];
}
}