3

Quick simple question. Apple's CoreData docs explain how delete rules work on a department's employees relationship. Delete a department, and various different things can happen to the associated employees. But what about an employee's department relationship? Should I set my delete rule to No Action, since I don't want the deletion of an employee to have any effect on the department?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
ed94133
  • 1,477
  • 2
  • 19
  • 40

2 Answers2

2

You usually use nullify. That just means the relationship is set to nil. If you use No Action no KVO notification is sent to the other end of the relationship. This can cause problems if objects still think they have a relationship.

TechZen
  • 64,370
  • 15
  • 118
  • 145
0

Yes, basically what TechZen said. The point is your own assumption that you don't want deletion of an employee to affect department in any way is misleading since with inverse relationships you would most certainly want department to know they just lost one employee.

svena
  • 2,769
  • 20
  • 25
  • Thanks for this clarifying comment. – ed94133 Sep 21 '10 at 21:35
  • It is strange that the Apple documentation doesnt give an example of this. The rule seems to be about what to do to the object at the other end and nullifying it sure doesnt sound right. I was similarly concerned about using nullify from children back to the parent. But I guess nullify is correct. – Sani Elfishawy Aug 16 '14 at 03:10