Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 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
@doctrinebot doctrinebot added this to the 2.2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.