From bf80ee6a30f04aed406a3253ef7459b4fcf11bda Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Sat, 3 Mar 2012 13:16:26 -0500 Subject: [PATCH] [DDC-1673] Fixed unused in ProxyFactory. --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 50bf18a7c..92a51481c 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -106,11 +106,16 @@ class ProxyFactory * Generate the Proxy file name * * @param string $className + * @param string $baseDir Optional base directory for proxy file name generation. + * If not specified, the directory configured on the Configuration of the + * EntityManager will be used by this factory. * @return string */ - private function getProxyFileName($className) + private function getProxyFileName($className, $baseDir = null) { - return $this->_proxyDir . DIRECTORY_SEPARATOR . '__CG__' . str_replace('\\', '', $className) . '.php'; + $proxyDir = $baseDir ?: $this->_proxyDir; + + return $proxyDir . DIRECTORY_SEPARATOR . '__CG__' . str_replace('\\', '', $className) . '.php'; } /** @@ -124,14 +129,16 @@ class ProxyFactory public function generateProxyClasses(array $classes, $toDir = null) { $proxyDir = $toDir ?: $this->_proxyDir; - $proxyDir = rtrim($proxyDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $proxyDir = rtrim($proxyDir, DIRECTORY_SEPARATOR); + foreach ($classes as $class) { /* @var $class ClassMetadata */ if ($class->isMappedSuperclass) { continue; } - $proxyFileName = $this->getProxyFileName($class->name); + $proxyFileName = $this->getProxyFileName($class->name, $proxyDir); + $this->_generateProxyClass($class, $proxyFileName, self::$_proxyClassTemplate); } }