主义实体错误

时间:2015-03-26 07:56:25

标签: doctrine entity

我从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();
}

1 个答案:

答案 0 :(得分:1)

mappedBy="item"需要mappedBy="question"