Skip to content

Commit

Permalink
Fix method order
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jan 9, 2024
1 parent 6da793c commit fc32d0a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/GridFS/CollectionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ public function deleteChunksByFilesId($id): void
}

/**
* Deletes a GridFS file and related chunks by ID.
*
* @param mixed $id
* Delete all GridFS files and chunks for a given filename.
*/
public function deleteFileAndChunksById($id): void
{
$this->filesCollection->deleteOne(['_id' => $id]);
$this->chunksCollection->deleteMany(['files_id' => $id]);
}

public function deleteFileAndChunksByFilename(string $filename): int
{
/** @var iterable<array{_id: mixed}> $files */
Expand All @@ -112,6 +104,17 @@ public function deleteFileAndChunksByFilename(string $filename): int
return $count ?? 0;
}

/**
* Deletes a GridFS file and related chunks by ID.
*
* @param mixed $id
*/
public function deleteFileAndChunksById($id): void
{
$this->filesCollection->deleteOne(['_id' => $id]);
$this->chunksCollection->deleteMany(['files_id' => $id]);
}

/**
* Drops the GridFS files and chunks collections.
*/
Expand Down

0 comments on commit fc32d0a

Please sign in to comment.