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

alias the proxy class on import to avoid "already exists" error

This commit is contained in:
MDrollette 2013-03-01 11:58:51 -06:00
parent 2372a85d9f
commit 1846f5845c

View file

@ -23,7 +23,7 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Proxy\AbstractProxyFactory; use Doctrine\Common\Proxy\AbstractProxyFactory;
use Doctrine\Common\Proxy\ProxyDefinition; use Doctrine\Common\Proxy\ProxyDefinition;
use Doctrine\Common\Util\ClassUtils; use Doctrine\Common\Util\ClassUtils;
use Doctrine\Common\Proxy\Proxy; use Doctrine\Common\Proxy\Proxy as BaseProxy;
use Doctrine\Common\Proxy\ProxyGenerator; use Doctrine\Common\Proxy\ProxyGenerator;
use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\ORM\Persisters\BasicEntityPersister; use Doctrine\ORM\Persisters\BasicEntityPersister;
@ -116,7 +116,7 @@ class ProxyFactory extends AbstractProxyFactory
private function createInitializer(ClassMetadata $classMetadata, BasicEntityPersister $entityPersister) private function createInitializer(ClassMetadata $classMetadata, BasicEntityPersister $entityPersister)
{ {
if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) { if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) {
return function (Proxy $proxy) use ($entityPersister, $classMetadata) { return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
$proxy->__setInitializer(null); $proxy->__setInitializer(null);
$proxy->__setCloner(null); $proxy->__setCloner(null);
@ -141,7 +141,7 @@ class ProxyFactory extends AbstractProxyFactory
}; };
} }
return function (Proxy $proxy) use ($entityPersister, $classMetadata) { return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
$proxy->__setInitializer(null); $proxy->__setInitializer(null);
$proxy->__setCloner(null); $proxy->__setCloner(null);
@ -177,7 +177,7 @@ class ProxyFactory extends AbstractProxyFactory
*/ */
private function createCloner(ClassMetadata $classMetadata, BasicEntityPersister $entityPersister) private function createCloner(ClassMetadata $classMetadata, BasicEntityPersister $entityPersister)
{ {
return function (Proxy $proxy) use ($entityPersister, $classMetadata) { return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
if ($proxy->__isInitialized()) { if ($proxy->__isInitialized()) {
return; return;
} }