• 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: Addressing Relationships in awakeFromInsert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing Relationships in awakeFromInsert


  • Subject: Re: Addressing Relationships in awakeFromInsert
  • From: Frédéric Testuz <email@hidden>
  • Date: Thu, 11 Aug 2005 13:29:13 +0200


Le 11 août 05 à 00:33, August Trometer a écrit :

Sorry for not being clear. I guess I'm not explaining this properly, so I'll try again with more detail.

I've got 2 Entities: Show and Episode.

In my model, I've defined an inverse relationship between Show and Episode, so that a Show has a to-many relationship (called "episodes") with the Episode entity, and Epsiode has a to-one relationship (called "show") with the Show entity. The relationship from Show to Episode is optional, while the relationship from Episode to Show is not (since you can't have an Episode without a Show).

When I create a Show, everything is fine -- I can edit, update, whatever. I'm not wanting Episodes to be created when a Show is created, nor am I wanting a Show to be created when an Episode is.

In my UI, I'm using a contentSet to define what Episodes show show in my list, based on the Show that is selected. This all works fine.

So, now I add an Episode for a particular show. Because everything works up to this point -- episodes for a certain Show only appear when that particular Show is selected -- I'm assuming that the relationship does exist between Episode and Show. I want to take advantage of that when the Episodes are created. That's where awakeFromInsert comes in.

I think you can have this without a line of code. I did it this week- end for entities relationships Book<-->>Role.


In your UI, you have two array controller.

1. ShowArrayController, with managedObjectContext binding set and Automatically prepares content on.
2. EpisodeArrayController, with managedObjectContext set, contentSet binding set to ShowArrayController.selection.episodes and Automatically prepares content off.
3. A button with its action set to EpisodeArraController.add:
(add also table views, edit fields, etc.)


And all works.

Frédéric

_______________________________________________
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


References: 
 >Addressing Relationships in awakeFromInsert (From: August Trometer <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: Jim Correia <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: August Trometer <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: mmalcolm crawford <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: August Trometer <email@hidden>)

  • Prev by Date: Re: [Moderator] Re: Option-click on my app hides the other app
  • Next by Date: NSImageView doesn't change with setImage
  • Previous by thread: Re: Addressing Relationships in awakeFromInsert
  • Next by thread: WebServices problem
  • Index(es):
    • Date
    • Thread