Relationship Modelling in Core Data
- by Stevie
Hi there,
I'm fairly new to Objective C and Core Data and have a problem designing a case where players team up one-on-one and have multiple matches that end up with a specific result.
With MySQL, I would have a Player table (player primary key, name) and a match table (player A foreign key, player B foreign key, result).
Now how do I do this with Core Data? I can easily tie a player entity to a match entity using a relationship. But how do I model the inverse direction for the second player ref. in the match entity?
Player
Name: Attribute
Match: Relationship Match
Match
Result: Attribute
PlayerA: Relationship to Player (<- Inverse to Player.Match)
PlayerB: Relationship to Player (<- Inverse to ????)
Would be great if someone could give me an idea on this!
Thanks,
Stevie.