Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'DDC-1771'

  • Loading branch information...
commit c92393026d28e3bec2fc40706db52d321267eb42 2 parents a1a9f85 + d54fdf4
@beberlei beberlei authored
View
7 lib/Doctrine/ORM/Proxy/ProxyFactory.php
@@ -125,22 +125,27 @@ private function getProxyFileName($className, $baseDir = null)
* @param string $toDir The target directory of the proxy classes. If not specified, the
* directory configured on the Configuration of the EntityManager used
* by this factory is used.
+ * @return int Number of generated proxies.
*/
public function generateProxyClasses(array $classes, $toDir = null)
{
$proxyDir = $toDir ?: $this->_proxyDir;
$proxyDir = rtrim($proxyDir, DIRECTORY_SEPARATOR);
+ $num = 0;
foreach ($classes as $class) {
/* @var $class ClassMetadata */
- if ($class->isMappedSuperclass) {
+ if ($class->isMappedSuperclass || $class->reflClass->isAbstract()) {
continue;
}
$proxyFileName = $this->getProxyFileName($class->name, $proxyDir);
$this->_generateProxyClass($class, $proxyFileName, self::$_proxyClassTemplate);
+ $num++;
}
+
+ return $num;
}
/**
View
19 tests/Doctrine/Tests/ORM/Proxy/ProxyClassGeneratorTest.php
@@ -155,6 +155,20 @@ public function testClassWithSleepProxyGeneration()
$this->assertEquals(1, substr_count($classCode, 'function __sleep'));
}
+ /**
+ * @group DDC-1771
+ */
+ public function testSkipAbstractClassesOnGeneration()
+ {
+ $cm = new \Doctrine\ORM\Mapping\ClassMetadata(__NAMESPACE__ . '\\AbstractClass');
+ $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService);
+ $this->assertNotNull($cm->reflClass);
+
+ $num = $this->_proxyFactory->generateProxyClasses(array($cm));
+
+ $this->assertEquals(0, $num, "No proxies generated.");
+ }
+
public function testNoConfigDir_ThrowsException()
{
$this->setExpectedException('Doctrine\ORM\Proxy\ProxyException');
@@ -183,3 +197,8 @@ public function __sleep()
return array('id');
}
}
+
+abstract class AbstractClass
+{
+
+}

0 comments on commit c923930

Please sign in to comment.
Something went wrong with that request. Please try again.