diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 6bc7dc5272a..16cfde9317a 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -91,7 +91,9 @@ public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $au 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 739a41f1807..d66326faf2f 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -75,6 +75,33 @@ public function testReferenceProxyDelegatesLoadingToThePersister() $proxy->getDescription(); } + public function testSkipMappedSuperClassesOnGeneration(): void + { + $cm = new ClassMetadata(\stdClass::class); + $cm->isMappedSuperclass = true; + + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); + } + + /** + * @group 6625 + */ + public function testSkipEmbeddableClassesOnGeneration(): void + { + $cm = new ClassMetadata(\stdClass::class); + $cm->isEmbeddedClass = true; + + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); + } + /** * @group DDC-1771 */