[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:
Duplicate
duplicates DBAL-479 Doctrine2 schema-tool:update doesn't ... Resolved

 Description   

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.



 Comments   
Comment by Guilherme Blanco [ 13/Jan/12 ]

Duplicated

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 Thu Dec 18 23:55:57 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.