From bee74f898da0474b4bad44d41df84f1807036880 Mon Sep 17 00:00:00 2001 From: yktd26 Date: Tue, 31 Dec 2013 11:58:36 +0100 Subject: [PATCH 1/2] autoGenerate arg from bool to int For using all four modes of proxies generation, change the 4th arg of ProxyFactory's constructor to integer --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 4 ++-- tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index d33a590f0..fa309e2af 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -62,9 +62,9 @@ class ProxyFactory extends AbstractProxyFactory * @param \Doctrine\ORM\EntityManager $em The EntityManager the new factory works for. * @param string $proxyDir The directory to use for the proxy classes. It must exist. * @param string $proxyNs The namespace to use for the proxy classes. - * @param boolean $autoGenerate Whether to automatically generate proxy classes. + * @param boolean|int $autoGenerate Whether to automatically generate proxy classes. */ - public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = false) + public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = AbstractProxyFactory :: AUTOGENERATE_NEVER) { $proxyGenerator = new ProxyGenerator($proxyDir, $proxyNs); diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index d91a3f2b5..a5b97be73 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -10,6 +10,7 @@ use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\Mocks\UnitOfWorkMock; use Doctrine\Tests\Mocks\DriverMock; +use Doctrine\Common\Proxy\AbstractProxyFactory; /** * Test the proxy generator. Its work is generating on-the-fly subclasses of a given model, which implement the Proxy pattern. @@ -47,7 +48,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $this->emMock = EntityManagerMock::create($this->connectionMock); $this->uowMock = new UnitOfWorkMock($this->emMock); $this->emMock->setUnitOfWork($this->uowMock); - $this->proxyFactory = new ProxyFactory($this->emMock, sys_get_temp_dir(), 'Proxies', true); + $this->proxyFactory = new ProxyFactory($this->emMock, sys_get_temp_dir(), 'Proxies', AbstractProxyFactory :: AUTOGENERATE_ALWAYS); } public function testReferenceProxyDelegatesLoadingToThePersister() From c9e06a68541adbfc6ea17d116ee3b90a1dc4bdd0 Mon Sep 17 00:00:00 2001 From: yktd26 Date: Tue, 31 Dec 2013 12:25:14 +0100 Subject: [PATCH 2/2] Format code --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 2 +- tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index fa309e2af..aea572c2c 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -64,7 +64,7 @@ class ProxyFactory extends AbstractProxyFactory * @param string $proxyNs The namespace to use for the proxy classes. * @param boolean|int $autoGenerate Whether to automatically generate proxy classes. */ - public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = AbstractProxyFactory :: AUTOGENERATE_NEVER) + public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = AbstractProxyFactory::AUTOGENERATE_NEVER) { $proxyGenerator = new ProxyGenerator($proxyDir, $proxyNs); diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index a5b97be73..227cd608a 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -48,7 +48,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $this->emMock = EntityManagerMock::create($this->connectionMock); $this->uowMock = new UnitOfWorkMock($this->emMock); $this->emMock->setUnitOfWork($this->uowMock); - $this->proxyFactory = new ProxyFactory($this->emMock, sys_get_temp_dir(), 'Proxies', AbstractProxyFactory :: AUTOGENERATE_ALWAYS); + $this->proxyFactory = new ProxyFactory($this->emMock, sys_get_temp_dir(), 'Proxies', AbstractProxyFactory::AUTOGENERATE_ALWAYS); } public function testReferenceProxyDelegatesLoadingToThePersister()