Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
I have a to-many relationship from A to B and a to-many from B to A.

I use setvalue:forkey: to change the to-many AtoB, which works fine. Previously included links are removed, new links to A are added. However the links from A to B are not removed. So A still thinks it has a relationship with B, when it shouldn't. I thought the entire point of bidirectional relationships was to ensure data integrity, and to keep the relationships up to date. so that each side knows if it belongs to each other or not.

From the NSManagedobject class reference:
Given a collection object and a key that identifies a to-many relationship, relates the objects contained in the collection to the receiver, unrelating previously related objects if there were any.

How can I ensure that if a relationship in one direction is removed, the relationship in the other direction is also broken or removed?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.