1
0
mirror of synced 2025-01-31 12:32:59 +03:00

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

This commit is contained in:
guilhermeblanco 2010-03-10 20:38:20 +00:00
parent 273bc3dc22
commit 757a9529f8
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,17 @@
<?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.');
}
}

View File

@ -257,7 +257,9 @@ namespace <namespace> {
private function _load() {
if (!$this->__isInitialized__ && $this->_entityPersister) {
$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->_identifier);
}