b85411
b85411

Reputation: 10030

Doctrine entity error

I am getting this error from Doctrine:

The mappings X\Answer#question and X\Question#answers are inconsistent with each other.

I don't see what is wrong with it?

The classes are:

Answer:

/**
 * @ORM\ManyToOne(targetEntity="Question", inversedBy="answers")
 * @ORM\JoinColumn(name="question_id", referencedColumnName="question_id")
 */
private $question;

Question:

/**
 * @ORM\OneToMany(targetEntity="Answer", mappedBy="item")
 */
protected $answers;

public function __construct()
{
    $this->answers = new ArrayCollection();
}

Upvotes: 0

Views: 16

Answers (1)

b85411
b85411

Reputation: 10030

mappedBy="item" needed to be mappedBy="question".

Upvotes: 1

Related Questions