I have a working model in coredata with two entity:
– Customer
– Invoices
Customer has “invoices” property (1 to many) and Invoices has “customer” property (1 to 1).
Everything worked until i override the “setCustomer” method on Invoice class.
I write this code
-(void)setCustomer:(Customer *)customer {
[self willChangeValueForKey:@"Customer"];
[self setPrimitiveValue:customer forKey:@"Customer"];
[self didChangeValueForKey:@"Customer"];
[self recalulatePriceAndDiscounts];
}
where “recalculatePriceAndDiscount” is my own method that i need to call when i select different customer.
When i use this code the inverse relationship (customer->invoices) isn’t immediately available, i need to close and reopen my application to see customer’s invoices.
There is some other method that i need to call?
thanks
If the property is called “customer” (with a lower-case “c”) then you have to use that as key, e.g.