Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added check in doUpdate() to make sure the document containing the fi…

…le is returned when updating an existing document with a new file.
  • Loading branch information...
commit 0cc2a9a1d354e2e9ea1112209f1869c47e78d850 1 parent bf542f0
@pgodel pgodel authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Doctrine/MongoDB/GridFS.php
View
5 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'],
Please sign in to comment.
Something went wrong with that request. Please try again.