Advanced Core Data and Inverse Relationships Question
Advanced Core Data and Inverse Relationships Question
- Subject: Advanced Core Data and Inverse Relationships Question
- From: Ulai Beekam <email@hidden>
- Date: Sun, 19 Apr 2009 00:25:12 +0000
- Importance: Normal
I have two entities Boss and Employee. Boss has the to-many relationship 'employees'. The inverse is, naturally, the to-one relationship 'boss'.
My problem is this. I have a custom key that I implement for Boss. And while I am BETWEEN (i.e. the code between) willChangeValue:forKey: and didChangeValue:forKey:, I want to create a new Employee with *self* as a Boss. In other words, I am doing something like [newEmployee setBoss:self]; between willChange and didChange.
The problem is this: The inverse is not being maintained properly! That is, even though newEmployee's boss successfully becomes self, newEmployee is NOT added to self's employees collection! Is this normal? Is there any good reason for this? Or is this perhaps a bug in Core Data?
For your information, this problem goes a way if I execute didChangeValue:forKey: directly after willChangeValue:forKey: and have all the code after those two, i.e. it works fine when the code is NOT BETWEEN the willChange and didChange. Well, as you can imagine, it also works fine if I first run the code and in the end do willChange and didChange in succession.
Any ideas what is going on here?
Thanks, U.
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden