DDC-2810: Doctrine\ORM\EntityNotFoundException - Entity was not found. #3562

Closed
doctrinebot opened this Issue Nov 21, 2013 · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user icebrkr:

Doctrine\ORM\EntityNotFoundException - Entity was not found.

/zf2/framework/Infrastructure/Vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php:177

OneToOne join-side doesn't contain a matching record. One would assume this would just continue with an empty proxy object (full of null properties).

The offending line of code is on line 750 of DOctrine\ORM\BasicEntityPersister.php.

A quick fix/work-around was to replace the return null value with $entity which seems to be the object proxy class.

Change this:
return $entities ? $entities[0] : null;

To This:
return $entities ? $entities[0] : $entity;

@doctrinebot

Comment created by @beberlei:

A proxy object is created, when the value on the foreign key is != NULL. If you are having 0 thhere fore example, this problem will happen. We wont fix this however as this can cause serious issues over the project. Your database schema has to conform with Doctrine in this regard, its a requirement.

@doctrinebot

Issue was closed with resolution "Invalid"

@beberlei beberlei was assigned by doctrinebot 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