Commit 2ca40c7d authored by Will Banfield's avatar Will Banfield Committed by Jeremy Mikola

PHPLIB-158: delete removes files document first

parent 9089cd9a
......@@ -87,13 +87,13 @@ class Bucket
public function delete(ObjectId $id)
{
$file = $this->collectionsWrapper->getFilesCollection()->findOne(['_id' => $id]);
$this->collectionsWrapper->getFilesCollection()->deleteOne(['_id' => $id]);
$this->collectionsWrapper->getChunksCollection()->deleteMany(['files_id' => $id]);
if ($file === null) {
throw new GridFSFileNotFoundException($id, $this->collectionsWrapper->getFilesCollection()->getNameSpace());
}
$this->collectionsWrapper->getFilesCollection()->deleteOne(['_id' => $id]);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment