[2.0] Fixed issue with Proxy classes that was silently failing to load correspondent Entity.
This commit is contained in:
parent
273bc3dc22
commit
757a9529f8
17
lib/Doctrine/ORM/EntityNotFoundException.php
Normal file
17
lib/Doctrine/ORM/EntityNotFoundException.php
Normal 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.');
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user