I'm trying to port my model code to use Core Data. My model is something like this:

I have a Company. It has two to-many relationships, currentEmployees and previousEmployees which are naturally both to Employees.

Employees have a to-one relationship to the Company that is the inverse of both the currentEmployees and previousEmployees. That is, the employee (records) belong to the Company regardless of current/ previous "status".

I also have a Consultant. It has a to-many relationship to interestingEmployees. Nobody talking to an Employee needs to have access to the Consultant, so there is no inverse relationship.


I have two problems with this model. When I compile it, I get a warning:

Consultant.interestingEmployees -- to-many relationship does not have an inverse: this is an advanced setting (no object can be in multiple destinations for a specific relationship)

This error doesn't make sense to me. Is it trying to say an object can only "belong" to one to-many relationship?


The other problem is that I do want to define an inverse for Employee.company, but I can't set it to *both* Company.currentEmployees and .previousEmployees. I think the answer is to maintain the Employee.company relationship field myself without any inverse, but then I get two more warnings for each of the Company to- many relationships.

This model was easy to implement in Foundation, I just created a bunch of Employee objects and just made sure they were in the proper sets (current/previous/interesting). I suppose I could model this by just having the "current"/"previous" and "interesting"/"not interesting" status be properties of the Employees themselves, but I'd prefer that A) Employees don't have access to these statuses and B) that my Company/Consultant can have tidy sets of relevant Employees. What's the best way for an object to be belong to multiple to-many relationships in Core Data?

thanks,
-natevw
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to