You can solve that by defining two inverse relationships: games1
as inverse to player1
, and games2
as inverse to player2
.
Defining inverse relationships is generally recommended, as it helps to keep the integrity
of the object graph. For example, if a user is deleted and the inverse relationship delete
rule is set to "Nullify", then the player1
/player2
entry in all related games is set to NULL
and does not point to non-existent user objects.