Re: Core Data Many2Many Relationships
Re: Core Data Many2Many Relationships
- Subject: Re: Core Data Many2Many Relationships
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 4 Aug 2005 16:13:27 -0700
On Aug 4, 2005, at 3:08 AM, Bill Cheeseman wrote:
One way to populate the extras relationship in a domain object
programmatically is to make domain a subclass of NSManagedObject and
implement the -add<Keys>Object and related Core Data accessor
methods. In
your case, you would name these -addExtrasObject: to link a single
extra
object into a domain object, and -addExtras: to add a set of extra
objects
to a domain object. Since the relationships are inverse (i.e.,
many-to-many), this would automatically link the domain object to
the extra
object (or each of the extras objects) at the same time.
Just for the sake of completeness, the easiest way to do this is
simply to use mutableSetValueForKey: (see "To-many Relationships":
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CoreData/Articles/cdRelationships.html>
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden