No duplicates π₯².
What happened?
I try to link the same class twice in another.
But the orm didn't let me do.
How can i do something like this :
#[Entity]
class Game extends AbstractModel
{
#[HasOne(target: User::class, innerKey: 'player_1_id', nullable: true, fkCreate: false, fkOnDelete: 'NO ACTION')]
private ?User $player1;
#[HasOne(target: User::class, innerKey: 'player_2_id', nullable: true, fkCreate: false, fkOnDelete: 'NO ACTION')]
private ?User $player2;
#[Entity(table: 'users')]
class User extends AbstractModel
{
#[hasOne(target: Game::class, innerKey: 'current_game_id', nullable: true, fkCreate: false, fkAction: 'NO ACTION')]
private ?Game $currentGame = null;
A game have 2 user ( player_1 and player_2 ) , the user have a reference to the game...
but in the game class he can be the player 1 or the player 2 ...
Version
No duplicates π₯².
What happened?
I try to link the same class twice in another.
But the orm didn't let me do.
How can i do something like this :
A game have 2 user ( player_1 and player_2 ) , the user have a reference to the game...
but in the game class he can be the player 1 or the player 2 ...
Version