NSObject's inverseForRelationshipKey: behavior
NSObject's inverseForRelationshipKey: behavior
- Subject: NSObject's inverseForRelationshipKey: behavior
- From: Tim Hart <email@hidden>
- Date: Thu, 26 Jan 2006 17:14:54 -0600
The documentation for NSClassDescription doesn't state what subclasses
should do in this case:
Suppose a class Parent has a one to many relationship with the class
Child.
@interface Parent
{
NSSet *children;
}
@end
Also suppose that the class Child has two separate associations with
Parent. One for Mom and one for Dad.
@interface Child
{
Parent *mom;
Parent *dad;
}
@end;
Outside of computers and OO, this is perfectly reasonable. A parent may
have many children. Biologically a child has exactly 2 parents (living
or dead), legally, a child has at most 2 parents.
What is 'inverseForRelationshipKey:' supposed to return in this case?
[parent inverseForRelationshipKey:@"children"];
I realize I have several opportunities to change the model so that
inverseRelationshipKey: will only have one choice (abstracting roles,
etc). I'm not worried about opportunities to change the model. I'm
implementing a concrete subclass of NSClassDescription and need to know
if there is accepted behavior for this particular case.
Tim Hart
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden