1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

Fixing DDC-2306

This commit is contained in:
Marco Pivetta 2013-02-21 02:20:11 +01:00
parent d8dd5129e7
commit a5ece5063a

View file

@ -2475,14 +2475,14 @@ class UnitOfWork implements PropertyChangedListener
&& isset($hints[Query::HINT_REFRESH_ENTITY]) && isset($hints[Query::HINT_REFRESH_ENTITY])
&& ($unmanagedProxy = $hints[Query::HINT_REFRESH_ENTITY]) !== $entity && ($unmanagedProxy = $hints[Query::HINT_REFRESH_ENTITY]) !== $entity
&& $unmanagedProxy instanceof Proxy && $unmanagedProxy instanceof Proxy
&& (($unmanagedProxyClass = $this->em->getClassMetadata(get_class($unmanagedProxy))) === $class)
) { ) {
// DDC-1238 - we have a managed instance, but it isn't the provided one. // DDC-1238 - we have a managed instance, but it isn't the provided one.
// Therefore we clear its identifier. Also, we must re-fetch metadata since the // Therefore we clear its identifier. Also, we must re-fetch metadata since the
// refreshed object may be anything // refreshed object may be anything
$class = $this->em->getClassMetadata(get_class($unmanagedProxy));
foreach ($class->identifier as $fieldName) { foreach ($unmanagedProxyClass->identifier as $fieldName) {
$class->reflFields[$fieldName]->setValue($unmanagedProxy, null); $unmanagedProxyClass->reflFields[$fieldName]->setValue($unmanagedProxy, null);
} }
return $unmanagedProxy; return $unmanagedProxy;