Say that I'm modelling a human body.  Each body has two arms, and I model them 
with the same entity; one has, maybe, setFlipped:YES and the other has 
setFlipped:NO.  But they are accessed for different purposes; sometimes I want 
the left arm and sometimes the right arm.  I'd therefore like to set up 
relationships thus:

 Body_Entity        Arm_Entity
     leftArm <----> body
    rightArm <----> body

But Core Data won't let me do this, because the Arm's 'body' relationship can 
only have one inverse relationship.  Instead, I must do this:

 Body_Entity        Arm_Entity
     leftArm <----> bodyLeft
    rightArm <----> bodyBody

which looks kind of silly, and also in order to access 'body' from an Arm 
object I need a silly accessor:

- (Body*)body {
    Body* body = [self bodyLeft] ;
    if (!body) {
        body = [self bodyRight] ;
    }
    
    return body ;
}

Is there a better way to model such a thing?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to