Skip to content

Commit 70f1f3e

Browse files
superdweebiejwage
authored andcommitted
Make it possible to re-persist removed embeded documents
Not sure why the restriction was there in the first place, but it seems like it isn't needed. If it is kept, I can't find any way to re-persist an embedded document marked for deletion.
1 parent 97f4e99 commit 70f1f3e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/Doctrine/ODM/MongoDB/UnitOfWork.php

+7-9
Original file line numberDiff line numberDiff line change
@@ -1914,16 +1914,14 @@ private function doPersist($document, array &$visited)
19141914
"Behavior of persist() for a detached document is not yet defined.");
19151915
break;
19161916
case self::STATE_REMOVED:
1917-
if ( ! $class->isEmbeddedDocument) {
1918-
// Document becomes managed again
1919-
if ($this->isScheduledForDelete($document)) {
1920-
unset($this->documentDeletions[$oid]);
1921-
} else {
1922-
//FIXME: There's more to think of here...
1923-
$this->scheduleForInsert($class, $document);
1924-
}
1925-
break;
1917+
// Document becomes managed again
1918+
if ($this->isScheduledForDelete($document)) {
1919+
unset($this->documentDeletions[$oid]);
1920+
} else {
1921+
//FIXME: There's more to think of here...
1922+
$this->scheduleForInsert($class, $document);
19261923
}
1924+
break;
19271925
default:
19281926
throw MongoDBException::invalidDocumentState($documentState);
19291927
}

0 commit comments

Comments
 (0)