Skip to content
This repository

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

Closed
danielkbx opened this Issue · 1 comment

2 participants

Daniel Wetzel Benjamin Eberlei
Daniel Wetzel

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();
Benjamin Eberlei
Owner

Fixed

Benjamin Eberlei beberlei closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.