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

Commit

Permalink
Merge pull request #61 from pgodel/patch-1
Browse files Browse the repository at this point in the history
Add check in doUpdate() to make sure the document containing the file is returned
  • Loading branch information
jwage committed Sep 9, 2012
2 parents b5ab03b + 0cc2a9a commit de0c453
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
// 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(
$document['filename'],
$document['length'],
Expand Down

0 comments on commit de0c453

Please sign in to comment.