Re: Why is it wrong to have relationships without an inverse in Core Data?
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