• 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: really elementary to-many inverse relationship question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: really elementary to-many inverse relationship question


  • Subject: Re: really elementary to-many inverse relationship question
  • From: "I. Savant" <email@hidden>
  • Date: Sat, 2 Dec 2006 20:23:44 -0500

Matt:

When I had this exact problem, I found that at some point I (or, I'm more convinced, an evil spirit) had unset the inverse relationship in my MOM. I would have sworn that I'd verified it, but ... ;-)

Beyond that, all I can say is yes, if your inverse relationship is properly configured, the inverse should be automatically 'hooked up'.

--
I.S.


On Dec 2, 2006, at 7:19 PM, Matt Neuburg wrote:

I'm initially populating a managed object context "by hand". In my model, a
Stack entity has to-many relationship "backgrounds" to Background, and a
Background entity has a to-one relationship "stack" to Stack. Those
relationships are inverses.


In plain English, a stack can have many backgrounds but a background can
have only one stack.


So I set the background's one stack:

  [background setValue: stack forKey: @"stack"];

That works, as I can see through logging. But I also see that the stack has
no backgrounds.


So the inverse relationship is not being updated automatically. My question
is: why not? It says right in the docs that it should be:


"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."


So is that just not true? I'm perfectly willing to populate both ends of the
relationship myself, and I am having no difficulty doing so, like this:


[[stack mutableSetValueForKey:@"backgrounds"] addObject: background];

I don't mind doing that, but shouldn't I not have to? Thx - m.

--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40gmail.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >really elementary to-many inverse relationship question (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: really elementary to-many inverse relationship question
  • Next by Date: Re: NSWindowController subclass initialization
  • Previous by thread: Re: really elementary to-many inverse relationship question
  • Next by thread: AppleScript opens a doc, handleOpenScriptCommand: raises exception
  • Index(es):
    • Date
    • Thread