Re: CoreData - constraint?
Re: CoreData - constraint?
- Subject: Re: CoreData - constraint?
- From: Chris Hanson <email@hidden>
- Date: Fri, 1 Jul 2005 11:11:23 -0700
On Jul 1, 2005, at 9:55 AM, Michael Hanna wrote:
I have a simple datamodel, an Entry can have many Passages. The
interface has two tableviews, one for entries, one for passages.
The thing I don't understand is that I can create passages via an
nsarraycontroller -add even though there are no entries wouldn't
the one-to-many relationship in the datamodel constrain that?
No, it won't. The relationship is not a *constraint* on the objects
in your object graph, it's just an expression of a possible
association between objects in your object graph.
So as you've configured it, you can create arbitrary Entry instances
and arbitrary Passage instances completely independently.
It sounds like what you really want to do is set up a master-detail
interface where your first table shows Entry instances and your
second table shows the Passage instances associated with the selected
Entry via its "passages" relationship.
To do this, you just need to hook up your Passage array controller's
"contentSet" binding. Hook it to your Entry array controller, using
a controller key of "selection" -- representing the selected Entry,
if any -- and a model key path of "passages".
-- Chris
_______________________________________________
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