[DDC-1585] Doctrine2 doesn't check for the correct entity type on @ManyToOne relations Created: 07/Jan/12  Updated: 15/Jan/12  Resolved: 15/Jan/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.1.5
Fix Version/s: 2.2
Security Level: All

Type: Bug Priority: Major
Reporter: Timo A. Hummel Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
duplicates DBAL-479 Doctrine2 schema-tool:update doesn't ... Resolved


I made a mistake when creating a @ManyToOne entity:


  • @ManyToOne(targetEntity="Entities\EntityA")
    private $test;

However, I was setting Entities\EntityB into $test.

Doctrine2 doesn't check for this, resulting in a hard-to-find issue.

Comment by Guilherme Blanco [ 13/Jan/12 ]


Comment by Benjamin Eberlei [ 15/Jan/12 ]

This is not a duplicate, its a runtime issue in the code when setting the wrong target entity type.

Comment by Benjamin Eberlei [ 15/Jan/12 ]

Implemented an instanceof check.

Generated at Sat Aug 29 08:38:54 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.