Commit 757a9529 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Fixed issue with Proxy classes that was silently failing to load correspondent Entity.

parent 273bc3dc
<?php
namespace Doctrine\ORM;
/**
* Exception thrown when a Proxy fails to retrieve an Entity result.
*
* @author robo
* @since 2.0
*/
class EntityNotFoundException extends ORMException
{
public function __construct()
{
parent::__construct('Entity was found although one item was expected.');
}
}
\ No newline at end of file
...@@ -257,7 +257,9 @@ namespace <namespace> { ...@@ -257,7 +257,9 @@ namespace <namespace> {
private function _load() { private function _load() {
if (!$this->__isInitialized__ && $this->_entityPersister) { if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true; $this->__isInitialized__ = true;
$this->_entityPersister->load($this->_identifier, $this); if ($this->_entityPersister->load($this->_identifier, $this) === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
unset($this->_entityPersister); unset($this->_entityPersister);
unset($this->_identifier); unset($this->_identifier);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment