diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 7a1a2c671..b6e174351 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -91,7 +91,9 @@ class ProxyFactory extends AbstractProxyFactory protected function skipClass(ClassMetadata $metadata) { /* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */ - return $metadata->isMappedSuperclass || $metadata->getReflectionClass()->isAbstract(); + return $metadata->isMappedSuperclass + || $metadata->isEmbeddedClass + || $metadata->getReflectionClass()->isAbstract(); } /** diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index fd4fa6648..b789e3fae 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,6 +71,33 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $proxy->getDescription(); } + public function testSkipMappedSuperClassesOnGeneration() + { + $cm = new ClassMetadata('stdClass'); + $cm->isMappedSuperclass = true; + + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); + } + + /** + * @group 6625 + */ + public function testSkipEmbeddableClassesOnGeneration() + { + $cm = new ClassMetadata('stdClass'); + $cm->isEmbeddedClass = true; + + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); + } + /** * @group DDC-1771 */