我从Doctrine收到此错误:
The mappings X\Answer#question and X\Question#answers are inconsistent with each other.
我没看到它有什么问题?
课程是:
答案:
/**
* @ORM\ManyToOne(targetEntity="Question", inversedBy="answers")
* @ORM\JoinColumn(name="question_id", referencedColumnName="question_id")
*/
private $question;
问题:
/**
* @ORM\OneToMany(targetEntity="Answer", mappedBy="item")
*/
protected $answers;
public function __construct()
{
$this->answers = new ArrayCollection();
}
答案 0 :(得分:1)
mappedBy="item"
需要mappedBy="question"
。