Doctrine v2.2.1을 사용하고 있습니다. YML으로 정의 된 엔티티.Doctrine2 두 엔티티의 다중 관계
여기에는 주어진 연결을 통해 서로를 참조하는 2 개의 엔티티가 있습니다.
entities\User:
type: entity
table: user
oneToMany:
subjectNews:
targetEntity: entities\News
mappedBy: subjectUser
cascade: ["all"]
actionNews:
targetEntity: entities\News
mappedBy: actionUser
cascade: ["all"]
entities\News:
type: entity
table: news
manyToOne:
subjectUser:
targetEntity: entities\User
cascade: ["all"]
nullable: true
actionUser:
targetEntity: entities\User
cascade: ["all"]
nullable: true
이러한 정의에 따라 엔터티 클래스를 생성 할 때 엔터티 \ 사용자 PHP 클래스에서 예기치 않은 결과가 발생합니다. 어느 쪽인가.
/**
* Add subjectNews
*
* @param entities\News $subjectNews
* @return User
*/
public function addNews(\entities\News $subjectNews)
{
$this->subjectNews[] = $subjectNews;
return $this;
}
내 엔터티의 setter 메서드는 예상대로 잘 생성됩니다. 그러나 entities \ User의 추가 메소드는 예상대로 생성되지 않습니다.
내가 잘못 했나요? 아니면 이에 대한 해결 방법이 있습니까? 아니면 the issue referred in the Limitations and Known Issues doc of Doctrine2과 관련이 있습니까?
평화
체크 아웃 [이 답변]가 될 것이다 [1] [1] : HTTP : //stackoverflow.com/questions/6299738/doctrine-symfony-multiple-one-to-many-relations-on-same-model – frail