Skip to content

Commit

Permalink
Fixes #1050
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed Feb 27, 2019
1 parent 281b7d6 commit 2151a4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Metadata/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public function serialize()
'xmlDiscriminatorCData' => $this->xmlDiscriminatorCData,
'usingExpression' => $this->usingExpression,
'xmlDiscriminatorNamespace' => $this->xmlDiscriminatorNamespace,
'xmlRootPrefix' => $this->xmlRootPrefix,
'isList' => $this->isList,
'isMap' => $this->isMap,
]);
Expand Down Expand Up @@ -348,12 +349,18 @@ public function unserialize($str)
$this->xmlDiscriminatorCData = $unserialized['xmlDiscriminatorCData'];
}

if (isset($unserialized['xmlRootPrefix'])) {
$this->xmlRootPrefix = $unserialized['xmlRootPrefix'];
}

if (isset($unserialized['isList'])) {
$this->isList = $unserialized['isList'];
}

if (isset($unserialized['isMap'])) {
$this->isMap = $unserialized['isMap'];
}

parent::unserialize($parentStr);
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Metadata/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ public function testSerialization()
self::assertEquals($meta, $restoredMeta);
}

public function testSerializationClass()
{
$meta = new ClassMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder');
$meta->xmlRootPrefix = 'foo';
$meta->xmlDiscriminatorCData = 'foo';
$meta->xmlDiscriminatorAttribute = 'foo';
$meta->xmlRootName = 'foo';

$restoredMeta = unserialize(serialize($meta));
self::assertEquals($meta, $restoredMeta);
}

/**
* @dataProvider getAccessOrderCases
*/
Expand Down

0 comments on commit 2151a4b

Please sign in to comment.