1
0
mirror of synced 2025-01-31 04:21:44 +03:00

applying required fixes for DDC-2432

This commit is contained in:
Marco Pivetta 2013-05-09 21:14:58 +02:00
parent 07c207081e
commit 22c9f6ebec

View File

@ -117,6 +117,9 @@ class ProxyFactory extends AbstractProxyFactory
{
if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) {
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
$initializer = $proxy->__getInitializer();
$cloner = $proxy->__getCloner();
$proxy->__setInitializer(null);
$proxy->__setCloner(null);
@ -136,12 +139,19 @@ class ProxyFactory extends AbstractProxyFactory
$proxy->__wakeup();
if (null === $entityPersister->load($classMetadata->getIdentifierValues($proxy), $proxy)) {
$proxy->__setInitializer($initializer);
$proxy->__setCloner($cloner);
$proxy->__setInitialized(false);
throw new EntityNotFoundException();
}
};
}
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
$initializer = $proxy->__getInitializer();
$cloner = $proxy->__getCloner();
$proxy->__setInitializer(null);
$proxy->__setCloner(null);
@ -160,6 +170,10 @@ class ProxyFactory extends AbstractProxyFactory
$proxy->__setInitialized(true);
if (null === $entityPersister->load($classMetadata->getIdentifierValues($proxy), $proxy)) {
$proxy->__setInitializer($initializer);
$proxy->__setCloner($cloner);
$proxy->__setInitialized(false);
throw new EntityNotFoundException();
}
};