Re: CoreData warning: File.children -- to-many relationship does not have an inverse:
Re: CoreData warning: File.children -- to-many relationship does not have an inverse:
- Subject: Re: CoreData warning: File.children -- to-many relationship does not have an inverse:
- From: Quincey Morris <email@hidden>
- Date: Wed, 4 Aug 2010 00:04:34 -0700
On Aug 3, 2010, at 22:32, Ignacio Enriquez wrote:
> "Child" entity has:
> one to many "children" relationship with itself.
> one to one "parentChild" relationship with itself.
> one to one "parentFile" relationship with "File" entity.
>
> "File" entity has
> one to many "children relationship with "Child" entity.
> one to many "files" relationship with itself.
> one to one "parentFile" relationship with itself.
>
> Then I added its inverse relationships:(Because I got 6 warnings)
>
> Child.children 's inverse is children
> Child.parentChild 's inverse is parentChild
> Child.parentFile 's inverse is children (Why?, only children option is
> available.)
>
> File.children 's inverse is parentFile (Why?, only parentFile option
> is available)
> File.files ' inverse is files
> File.parentFile 's inverse is parentFile
I think you've hooked up the wrong inverses. You don't, for example, want Child.children's inverse to be children. Apart from anything else, that would be a many-to-many relationship, which you *don't* want.
Let's try it like this, looking at just entities:
File -files->> File (parent/subnode relationship for the sub-hierarchy of File objects owning File objects)
Child -children->> Child (parent/subnode relationship for the sub-hierarchy of Child objects owning Child objects)
File -children->> Child (parent/subnode relationship for the sub-hierarchy -- one level deep only -- of File objects owning Child objects)
Now let's add the inverses:
File -files->> File
File <-parentFile- File
Child -children->> Child
Child <-parentChild- Child
File -children->> Child
File <-parentFile- Child
(Single headed arrows are 1-1, double headed arrows are 1-many.)
That's 6 relationships, taken in inverse pairs. It's quite straightforward if you can get the right picture in mind. :)
_______________________________________________
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