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

Closed
opened 2026-01-22 14:21:20 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 21, 2013).

Originally assigned to: @beberlei on GitHub.

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;

Originally created by @doctrinebot on GitHub (Nov 21, 2013). Originally assigned to: @beberlei on GitHub. 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;
admin added the Bug label 2026-01-22 14:21:20 +01:00
admin closed this issue 2026-01-22 14:21:21 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2013):

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 commented on GitHub (Dec 13, 2013): 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.
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2013):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Dec 13, 2013): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3511