Doctrine과의 첫 번째 Symfony 프로젝트를 진행하고 있는데, 나는 차질을 겪었다. 저는 두 명의 선수와 함께 게임을 표현하려고합니다. 내가 갖고 싶은 관계는 PlayerOne과 PlayerTwo가 각각 Users 테이블의 ID에 맞춰져 있습니다. 이것은 내가 지금까지 가지고있는 것의 일부입니다 :YAML을 사용한 Doctrine의 1 대 2 관계
Game:
actAs: { Timestampable:- }
columns:
id: { type: integer, notnull: true, unique: true }
startDate: { type: timestamp, notnull: true }
playerOne: { type: integer, notnull: true }
playerTwo: { type: integer, notnull: true }
winner: { type: integer, notnull:true, default:0 }
relations:
User: { onUpdate: cascade, local: playerOne, foreign: id}
User: { onUpdate: cascade, local: playerTwo, foreign: id}
그건 작동하지 않습니다. 그것은 괜찮지 만, 생성하는 SQL은 playerTwo에 대한 제약 조건 만 포함합니다. 또한
User: { onUpdate: cascade, local: [playerOne, playerTwo], foreign: id}
:
User: [{ onUpdate: cascade, local: playerOne, foreign: id}, { onUpdate: cascade, local: playerTwo, foreign: id}]
그 마지막 두 던져 오류가 내가 빌드하려고 나는 몇 가지 다른 일을 시도했습니다. 내가 뭘하려고하는지 이해하고 그것을 성취하도록 도울 수있는 사람이 밖에 있습니까?
+1. 동일한 이름을 가진 2 개의 다른 속성을 가질 수 없기 때문에 동일한 이름을 가진 2 개의 관계를 가질 수 없습니다. –