Skip to content
This repository

Property ClassMetadata::file is not serialized #152

Merged
merged 2 commits into from over 2 years ago

2 participants

vladar Jonathan H. Wage
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.

Jonathan H. Wage jwage merged commit 8fc5d9a into from September 01, 2011
Jonathan H. Wage jwage closed this September 01, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
@@ -153,6 +153,10 @@ public function __sleep()
153 153
             $serialized[] = 'lifecycleCallbacks';
154 154
         }
155 155
 
  156
+        if ($this->file) {
  157
+            $serialized[] = 'file';
  158
+        }
  159
+
156 160
         return $serialized;
157 161
     }
158 162
 
2  lib/vendor/doctrine-common
... ...
@@ -1 +1 @@
1  
-Subproject commit 4b40ee86598d211a0015e8685b5eb668e8b5cb7d
  1
+Subproject commit 40f1bf16e84ddc5291a6a63aa00b9879c40e3500
2  tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php
@@ -28,6 +28,7 @@ public function testClassMetadataInstanceSerialization()
28 28
         $cm->setCustomRepositoryClass("UserRepository");
29 29
         $cm->setDiscriminatorField(array('name' => 'disc'));
30 30
         $cm->mapOneEmbedded(array('fieldName' => 'phonenumbers', 'targetDocument' => 'Bar'));
  31
+        $cm->setFile('customFileProperty');
31 32
         $this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
32 33
         $this->assertEquals(1, count($cm->fieldMappings));
33 34
 
@@ -46,6 +47,7 @@ public function testClassMetadataInstanceSerialization()
46 47
         $this->assertEquals(array('name' => 'disc'), $cm->discriminatorField);
47 48
         $this->assertTrue(is_array($cm->getFieldMapping('phonenumbers')));
48 49
         $this->assertEquals(1, count($cm->fieldMappings));
  50
+        $this->assertEquals('customFileProperty', $cm->file);
49 51
         $mapping = $cm->getFieldMapping('phonenumbers');
50 52
         $this->assertEquals('Documents\Bar', $mapping['targetDocument']);
51 53
     }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.