Re: One-to-many relationship
Re: One-to-many relationship
- Subject: Re: One-to-many relationship
- From: mmalc crawford <email@hidden>
- Date: Wed, 26 Sep 2007 22:34:42 -0700
On Sep 26, 2007, at 10:23 PM, Norio Ota wrote:
But how should I connect the department object to 'department' of
Employ object.
Is the following code OK?
[iEmployee setValue:deptObject forKey:@"department"];
Yes: <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html
>.
Note, though, that if you have properly modeled the inverse
relationship you only have to set one side (that is, if you add an
employee to the employees relationship you don't have to set the
department relationship and vice-versa).
"Most relationships are inherently bidirectional. Any changes made to
the relationships between objects should maintain the integrity of the
object graph. Provided that you have correctly modeled a relationship
in both directions and set the inverses, modifying one end of a
relationship automatically updates the other end—see “Manipulating
Relationships and Object Graph Integrity”."
mmalc
_______________________________________________
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