DDC-1585: Doctrine2 doesn't check for the correct entity type on @ManyToOne relations #2222

Closed
doctrinebot opened this Issue Jan 7, 2012 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user felicitus:

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.

@doctrinebot

Comment created by @guilhermeblanco:

Duplicated

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Comment created by @beberlei:

Implemented an instanceof check.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment