1
0
mirror of synced 2025-01-31 20:41:44 +03:00

Merge pull request #951 from md2perpe/MoreInformationalEntityNotFoundException

More informational entity not found exception
This commit is contained in:
Guilherme Blanco 2014-04-16 01:40:02 -04:00
commit 6e9b15a48f
3 changed files with 6 additions and 6 deletions

View File

@ -30,8 +30,8 @@ class EntityNotFoundException extends ORMException
/** /**
* Constructor. * Constructor.
*/ */
public function __construct() public function __construct($class)
{ {
parent::__construct('Entity was not found.'); parent::__construct("Entity of type '{$class}' was not found.");
} }
} }

View File

@ -142,7 +142,7 @@ class ProxyFactory extends AbstractProxyFactory
$proxy->__setCloner($cloner); $proxy->__setCloner($cloner);
$proxy->__setInitialized(false); $proxy->__setInitialized(false);
throw new EntityNotFoundException(); throw new EntityNotFoundException($classMetadata->getName());
} }
}; };
} }
@ -173,7 +173,7 @@ class ProxyFactory extends AbstractProxyFactory
$proxy->__setCloner($cloner); $proxy->__setCloner($cloner);
$proxy->__setInitialized(false); $proxy->__setInitialized(false);
throw new EntityNotFoundException(); throw new EntityNotFoundException($classMetadata->getName());
} }
}; };
} }
@ -202,7 +202,7 @@ class ProxyFactory extends AbstractProxyFactory
$original = $entityPersister->loadById($classMetadata->getIdentifierValues($proxy)); $original = $entityPersister->loadById($classMetadata->getIdentifierValues($proxy));
if (null === $original) { if (null === $original) {
throw new EntityNotFoundException(); throw new EntityNotFoundException($classMetadata->getName());
} }
foreach ($class->getReflectionClass()->getProperties() as $property) { foreach ($class->getReflectionClass()->getProperties() as $property) {

View File

@ -1842,7 +1842,7 @@ class UnitOfWork implements PropertyChangedListener
// If the identifier is ASSIGNED, it is NEW, otherwise an error // If the identifier is ASSIGNED, it is NEW, otherwise an error
// since the managed entity was not found. // since the managed entity was not found.
if ( ! $class->isIdentifierNatural()) { if ( ! $class->isIdentifierNatural()) {
throw new EntityNotFoundException; throw new EntityNotFoundException($class->getName());
} }
$managedCopy = $this->newInstance($class); $managedCopy = $this->newInstance($class);