Permalink
Browse files

Merge pull request #806 from researchgate/serialize-classmetadata

Serialize ClassMetadata::$associationMappings correctly
  • Loading branch information...
2 parents db5fd69 + 41a8519 commit ed46e36787a7916670a853bd06a15c3647a5cf6b @jwage jwage committed Feb 23, 2014
View
3 lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
@@ -104,6 +104,7 @@ public function __sleep()
// This metadata is always serialized/cached.
$serialized = array(
'fieldMappings',
+ 'associationMappings',
'identifier',
'name',
'namespace', // TODO: REMOVE
@@ -113,7 +114,7 @@ public function __sleep()
'generatorType',
'generatorOptions',
'idGenerator',
- 'indexes'
+ 'indexes',
);
// The rest of the metadata is only serialized if necessary.
View
2 tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php
@@ -33,6 +33,7 @@ public function testClassMetadataInstanceSerialization()
$cm->setSlaveOkay(true);
$this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
$this->assertEquals(1, count($cm->fieldMappings));
+ $this->assertEquals(1, count($cm->associationMappings));
$serialized = serialize($cm);
$cm = unserialize($serialized);
@@ -49,6 +50,7 @@ public function testClassMetadataInstanceSerialization()
$this->assertEquals('disc', $cm->discriminatorField);
$this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
$this->assertEquals(1, count($cm->fieldMappings));
+ $this->assertEquals(1, count($cm->associationMappings));
$this->assertEquals('customFileProperty', $cm->file);
$this->assertEquals('customDistanceProperty', $cm->distance);
$this->assertTrue($cm->slaveOkay);

0 comments on commit ed46e36

Please sign in to comment.