• 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: Why is it wrong to have relationships without an inverse in Core Data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is it wrong to have relationships without an inverse in Core Data?


  • Subject: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • From: Rick Mann <email@hidden>
  • Date: Tue, 25 Jun 2013 23:20:32 -0700

On Jun 25, 2013, at 22:57 , Luther Baker <email@hidden> wrote:

> At the risk of sounding like an idiot for stating the obvious ... why not
> create a (dummy) inverse relationship (Child.activeParent)? No one says you
> have to use it ... or heck, maybe you want to use it.
>
> Parent.children    <-------->> Child.parent
> Parent.activeChild <---------> Child.activeParent
>
> I just tested this and it works as expected. IE: setting Parent.activeChild
> to different children between saves cleans up both ends of the relationship
> automatically (each subsequent child's 'activeParent' field was
> automatically cleared when I set a different child to the
> Parent.activeChild property).
>
> I don't know, maybe I missed something.


I think that works, and I've done it before, but I find it very kludgey. I think I prefer the one-way-with-prepareForDeletion approach instead.

--
Rick




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Why is it wrong to have relationships without an inverse in Core Data?
      • From: Luther Baker <email@hidden>
References: 
 >Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Kyle Sluder <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Kyle Sluder <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Michael Crawford <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Charles Srstka <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Michael Crawford <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Ian Joyner <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Scott Ribe <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Alex Zavatone <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Roland King <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Alex Zavatone <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Howard Moon <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Rick Mann <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Graham Cox <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Alex Zavatone <email@hidden>)
 >Re: Why is it wrong to have relationships without an inverse in Core Data? (From: Luther Baker <email@hidden>)

  • Prev by Date: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Next by Date: Re: Still can't delete CoreData object
  • Previous by thread: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Next by thread: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Index(es):
    • Date
    • Thread