From cf84183c18b2a77410d201582740db3fe568e4e3 Mon Sep 17 00:00:00 2001 From: Marco Jantke Date: Tue, 29 Apr 2014 09:30:10 +0200 Subject: [PATCH 1/3] created test case to reproduce error --- .../ORM/Functional/Ticket/DDC3103Test.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php new file mode 100644 index 000000000..9e3c38896 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php @@ -0,0 +1,46 @@ +createAnnotationDriver()->loadMetadataForClass($className, $classMetadata); + + $this->assertTrue( + $classMetadata->isEmbeddedClass, + 'The isEmbeddedClass property should be true from the mapping data.' + ); + + $serialized = serialize($classMetadata); + $classMetadata = unserialize($serialized); + + $this->assertTrue( + $classMetadata->isEmbeddedClass, + 'The isEmbeddedClass property should still be true after serialization and unserialization.' + ); + } +} + +/** + * @Embeddable + */ +class DDC3103ArticleId +{ + /** + * @var string + * @Column(name="name", type="string", length=255) + */ + protected $nameValue; +} + + From f065a5c8b9b7c97b79b538e10e3c4388c3a886de Mon Sep 17 00:00:00 2001 From: Marco Jantke Date: Tue, 29 Apr 2014 09:30:37 +0200 Subject: [PATCH 2/3] fixed bug --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 62ea7bb9b..ba7a2d2df 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -852,6 +852,10 @@ class ClassMetadataInfo implements ClassMetadata $serialized[] = 'isMappedSuperclass'; } + if ($this->isEmbeddedClass) { + $serialized[] = 'isEmbeddedClass'; + } + if ($this->containsForeignIdentifier) { $serialized[] = 'containsForeignIdentifier'; } From 677cea474822a1cdc2d525a6c4baaba69000815b Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 29 Apr 2014 13:12:17 +0200 Subject: [PATCH 3/3] DDC-3103 - minor CS fixes/adjustments --- .../Tests/ORM/Functional/Ticket/DDC3103Test.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php index 9e3c38896..bb9ccde17 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3103Test.php @@ -9,9 +9,12 @@ use Doctrine\ORM\Mapping\ClassMetadata; */ class DDC3103Test extends \Doctrine\Tests\OrmFunctionalTestCase { + /** + * @covers \Doctrine\ORM\Mapping\ClassMetadataInfo::__sleep + */ public function testIssue() { - $className = __NAMESPACE__ . '\\DDC3103ArticleId'; + $className = __NAMESPACE__ . '\\DDC3103ArticleId'; $classMetadata = new ClassMetadata($className); $this->createAnnotationDriver()->loadMetadataForClass($className, $classMetadata); @@ -21,11 +24,8 @@ class DDC3103Test extends \Doctrine\Tests\OrmFunctionalTestCase 'The isEmbeddedClass property should be true from the mapping data.' ); - $serialized = serialize($classMetadata); - $classMetadata = unserialize($serialized); - $this->assertTrue( - $classMetadata->isEmbeddedClass, + unserialize(serialize($classMetadata))->isEmbeddedClass, 'The isEmbeddedClass property should still be true after serialization and unserialization.' ); } @@ -42,5 +42,3 @@ class DDC3103ArticleId */ protected $nameValue; } - -