Permalink
Browse files

Merge pull request #61 from pgodel/patch-1

Add check in doUpdate() to make sure the document containing the file is returned
  • Loading branch information...
2 parents b5ab03b + 0cc2a9a commit de0c453a096d41f5f6186c3f8e4beb1e87d751af @jwage jwage committed Sep 9, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Doctrine/MongoDB/GridFS.php
@@ -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'],

0 comments on commit de0c453

Please sign in to comment.