From 6622bbbbf37f201cc65bc4d7290b8e0d8ac82240 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 12:11:03 +0900 Subject: [PATCH 1/5] 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 7a1a2c671..fd2178da7 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -91,7 +91,7 @@ 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..0207f72c2 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,6 +71,26 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $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 f1534610e15f6a22c6ca57086f5c59965e00b61b Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 20:29:27 +0900 Subject: [PATCH 2/5] 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 0207f72c2..feeb954a3 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,24 +71,27 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $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 f736acc8f573ff1833e5190055e3a2add8a04819 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 16 Aug 2017 20:47:54 +0900 Subject: [PATCH 3/5] 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 feeb954a3..b738f9dff 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,6 +71,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $proxy->getDescription(); } + public function testSkipMappedSuperClassesOnGeneration(): void { $cm = new ClassMetadata(\stdClass::class); @@ -78,7 +79,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $num = $this->proxyFactory->generateProxyClasses([$cm]); - self::assertSame(0, $num, "No proxies generated."); + self::assertSame(0, $num, 'No proxies generated.'); } /** @@ -91,7 +92,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $num = $this->proxyFactory->generateProxyClasses([$cm]); - self::assertSame(0, $num, "No proxies generated."); + self::assertSame(0, $num, 'No proxies generated.'); } /** From 8f772109550b02fe1285322743fd3c1254ee284e Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 16 Aug 2017 15:16:00 +0200 Subject: [PATCH 4/5] #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 fd2178da7..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->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 b738f9dff..6b0725d2f 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,15 +71,16 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $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.' + ); } /** @@ -90,9 +91,11 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $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.' + ); } /** From ee22be27a51880ab8668847f692b3223b6bfeab7 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 16 Aug 2017 15:21:14 +0200 Subject: [PATCH 5/5] #6625 #6626 removing PHP 5.3 incompatibilities (required for backport) --- tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index 6b0725d2f..b789e3fae 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -71,9 +71,9 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase $proxy->getDescription(); } - public function testSkipMappedSuperClassesOnGeneration(): void + public function testSkipMappedSuperClassesOnGeneration() { - $cm = new ClassMetadata(\stdClass::class); + $cm = new ClassMetadata('stdClass'); $cm->isMappedSuperclass = true; self::assertSame( @@ -86,9 +86,9 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase /** * @group 6625 */ - public function testSkipEmbeddableClassesOnGeneration(): void + public function testSkipEmbeddableClassesOnGeneration() { - $cm = new ClassMetadata(\stdClass::class); + $cm = new ClassMetadata('stdClass'); $cm->isEmbeddedClass = true; self::assertSame(