From 9e837dc53c45d005bfaca342ba0e5d73c7391198 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 12:11:03 +0900 Subject: [PATCH 1/4] Skip embeddable classes proxy generation --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 2 +- .../Tests/ORM/Proxy/ProxyFactoryTest.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 6bc7dc5272a..1ec22bfd039 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -91,7 +91,7 @@ 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..a85ee960ddc 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -75,6 +75,26 @@ public function testReferenceProxyDelegatesLoadingToThePersister() $proxy->getDescription(); } + public function testSkipMappedSuperClassesOnGeneration() + { + $cm = new ClassMetadata(\stdClass::class); + $cm->isMappedSuperclass = true; + + $num = $this->proxyFactory->generateProxyClasses([$cm]); + + $this->assertEquals(0, $num, "No proxies generated."); + } + + public function testSkipEmbeddableClassesOnGeneration() + { + $cm = new ClassMetadata(\stdClass::class); + $cm->isEmbeddedClass = true; + + $num = $this->proxyFactory->generateProxyClasses([$cm]); + + $this->assertEquals(0, $num, "No proxies generated."); + } + /** * @group DDC-1771 */ From de6d932e8c09e30dc3a470d4d48099fca57eb8a8 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 20:29:27 +0900 Subject: [PATCH 2/4] Fix CS / Add annotation --- tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index a85ee960ddc..a26465f37c0 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -75,24 +75,27 @@ public function testReferenceProxyDelegatesLoadingToThePersister() $proxy->getDescription(); } - public function testSkipMappedSuperClassesOnGeneration() + public function testSkipMappedSuperClassesOnGeneration(): void { $cm = new ClassMetadata(\stdClass::class); $cm->isMappedSuperclass = true; $num = $this->proxyFactory->generateProxyClasses([$cm]); - $this->assertEquals(0, $num, "No proxies generated."); + self::assertSame(0, $num, "No proxies generated."); } - public function testSkipEmbeddableClassesOnGeneration() + /** + * @group 6625 + */ + public function testSkipEmbeddableClassesOnGeneration(): void { $cm = new ClassMetadata(\stdClass::class); $cm->isEmbeddedClass = true; $num = $this->proxyFactory->generateProxyClasses([$cm]); - $this->assertEquals(0, $num, "No proxies generated."); + self::assertSame(0, $num, "No proxies generated."); } /** From 0bc91f87339601bf2d8af607b8e67735eefa66b4 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 20:47:54 +0900 Subject: [PATCH 3/4] Replace double quote with single quote --- tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index a26465f37c0..9a575b80aa5 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -75,6 +75,7 @@ public function testReferenceProxyDelegatesLoadingToThePersister() $proxy->getDescription(); } + public function testSkipMappedSuperClassesOnGeneration(): void { $cm = new ClassMetadata(\stdClass::class); @@ -82,7 +83,7 @@ public function testSkipMappedSuperClassesOnGeneration(): void $num = $this->proxyFactory->generateProxyClasses([$cm]); - self::assertSame(0, $num, "No proxies generated."); + self::assertSame(0, $num, 'No proxies generated.'); } /** @@ -95,7 +96,7 @@ public function testSkipEmbeddableClassesOnGeneration(): void $num = $this->proxyFactory->generateProxyClasses([$cm]); - self::assertSame(0, $num, "No proxies generated."); + self::assertSame(0, $num, 'No proxies generated.'); } /** From 71218b66b9791079ff3327384e99fb1b8a981777 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 16 Aug 2017 15:16:00 +0200 Subject: [PATCH 4/4] #6626 #6625 minor CS fixes (removed useless assignments) --- lib/Doctrine/ORM/Proxy/ProxyFactory.php | 4 +++- .../Tests/ORM/Proxy/ProxyFactoryTest.php | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 1ec22bfd039..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->isEmbeddedClass || $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 9a575b80aa5..d66326faf2f 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -75,15 +75,16 @@ public function testReferenceProxyDelegatesLoadingToThePersister() $proxy->getDescription(); } - public function testSkipMappedSuperClassesOnGeneration(): void { $cm = new ClassMetadata(\stdClass::class); $cm->isMappedSuperclass = true; - $num = $this->proxyFactory->generateProxyClasses([$cm]); - - self::assertSame(0, $num, 'No proxies generated.'); + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); } /** @@ -94,9 +95,11 @@ public function testSkipEmbeddableClassesOnGeneration(): void $cm = new ClassMetadata(\stdClass::class); $cm->isEmbeddedClass = true; - $num = $this->proxyFactory->generateProxyClasses([$cm]); - - self::assertSame(0, $num, 'No proxies generated.'); + self::assertSame( + 0, + $this->proxyFactory->generateProxyClasses([$cm]), + 'No proxies generated.' + ); } /**