Jira issue originally created by user felicitus:
I made a mistake when creating a @ManyToOne entity:
However, I was setting Entities\EntityB into $test.
Doctrine2 doesn't check for this, resulting in a hard-to-find issue.
Comment created by @guilhermeblanco:
Comment created by @beberlei:
This is not a duplicate, its a runtime issue in the code when setting the wrong target entity type.
Implemented an instanceof check.
Issue was closed with resolution "Fixed"