• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData - constraint?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CoreData - constraint?
      • From: Chris Hanson <email@hidden>
References: 
 >CoreData - constraint? (From: Michael Hanna <email@hidden>)

  • Prev by Date: Re: [CAcnTItem indexPath]: selector not recognized [self = 0x15d26c90]]
  • Next by Date: Re: NSCell's cellSize per table column row?
  • Previous by thread: CoreData - constraint?
  • Next by thread: Re: CoreData - constraint?
  • Index(es):
    • Date
    • Thread