Proxy class instance cannot be bulk updated (missing _rev) #70

Closed
danielkbx opened this Issue Jul 23, 2013 · 1 comment

2 participants

@danielkbx

When loading a document which references another document a proxy class instance is used.
When this is bulk updated the update fails since there is no _rev field. I did not check but a normal update would probably fail as well.

When the proxy class loads the data from the database there is already an entry for the revision id in the document manager. This one need to be updated.

--- a/application/library/Doctrine/ODM/CouchDB/UnitOfWork.php
+++ b/application/library/Doctrine/ODM/CouchDB/UnitOfWork.php
@@ -221,6 +221,7 @@ class UnitOfWork
             if ( ($document instanceof Proxy && !$document->__isInitialized__) || isset($hints['refresh'])) {
                 $overrideLocalValues = true;
                 $oid = spl_object_hash($document);
+                               $this->documentRevisions[$oid] = $rev;
             }
         } else {
             $document = $class->newInstance();
@beberlei
Doctrine member

Fixed

@beberlei beberlei closed this Jul 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment