Relationship Modelling in Core Data
Posted
by Stevie
on Stack Overflow
See other posts from Stack Overflow
or by Stevie
Published on 2009-10-03T21:26:41Z
Indexed on
2010/03/08
5:06 UTC
Read the original article
Hit count: 364
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.
© Stack Overflow or respective owner