Skip to content

Loading…

Property ClassMetadata::file is not serialized #152

Merged
merged 2 commits into from

2 participants

@vladar

This is causing errors, when saving gridfs files with persistent metadata cache engine (like apc, memcached, etc).

I've also found same bug in Jira - http://www.doctrine-project.org/jira/browse/MODM-132 but seems that it is not fixed yet.

Added fix + tests.

@jwage jwage merged commit 8fc5d9a into doctrine:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
4 lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
@@ -153,6 +153,10 @@ public function __sleep()
$serialized[] = 'lifecycleCallbacks';
}
+ if ($this->file) {
+ $serialized[] = 'file';
+ }
+
return $serialized;
}
2 lib/vendor/doctrine-common
@@ -1 +1 @@
-Subproject commit 4b40ee86598d211a0015e8685b5eb668e8b5cb7d
+Subproject commit 40f1bf16e84ddc5291a6a63aa00b9879c40e3500
View
2 tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php
@@ -28,6 +28,7 @@ public function testClassMetadataInstanceSerialization()
$cm->setCustomRepositoryClass("UserRepository");
$cm->setDiscriminatorField(array('name' => 'disc'));
$cm->mapOneEmbedded(array('fieldName' => 'phonenumbers', 'targetDocument' => 'Bar'));
+ $cm->setFile('customFileProperty');
$this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
$this->assertEquals(1, count($cm->fieldMappings));
@@ -46,6 +47,7 @@ public function testClassMetadataInstanceSerialization()
$this->assertEquals(array('name' => 'disc'), $cm->discriminatorField);
$this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
$this->assertEquals(1, count($cm->fieldMappings));
+ $this->assertEquals('customFileProperty', $cm->file);
$mapping = $cm->getFieldMapping('phonenumbers');
$this->assertEquals('Documents\Bar', $mapping['targetDocument']);
}
Something went wrong with that request. Please try again.