Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Added check in doUpdate() to make sure the document containing the fi…
Browse files Browse the repository at this point in the history
…le is returned when updating an existing document with a new file.
  • Loading branch information
pgodel committed Jul 10, 2012
1 parent bf542f0 commit 0cc2a9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Doctrine/MongoDB/GridFS.php
Expand Up @@ -70,7 +70,10 @@ protected function doUpdate($query, array $newObj, array $options = array())


// First do a find and remove query to remove the file metadata and chunks so // First do a find and remove query to remove the file metadata and chunks so
// we can restore the file below // we can restore the file below
$document = $this->findAndRemove($query, $options); if (null === $document = $this->findAndRemove($query, $options)) {
throw new \Exception("Could not find original document containing file");
}

unset( unset(
$document['filename'], $document['filename'],
$document['length'], $document['length'],
Expand Down

0 comments on commit 0cc2a9a

Please sign in to comment.