Skip to content

Commit 6cd2b40

Browse files
committed
PHPLIB-197: Support non-ObjectID identifiers for GridFS files
1 parent 5ffd050 commit 6cd2b40

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/GridFS/Bucket.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public function __construct(Manager $manager, $databaseName, array $options = []
8585
* If the files collection document is not found, this method will still
8686
* attempt to delete orphaned chunks.
8787
*
88-
* @param ObjectId $id ObjectId of the file
88+
* @param mixed $id File ID
8989
* @throws FileNotFoundException
9090
*/
91-
public function delete(ObjectId $id)
91+
public function delete($id)
9292
{
9393
$file = $this->collectionWrapper->findFileById($id);
9494
$this->collectionWrapper->deleteFileAndChunksById($id);
@@ -101,11 +101,11 @@ public function delete(ObjectId $id)
101101
/**
102102
* Writes the contents of a GridFS file to a writable stream.
103103
*
104-
* @param ObjectId $id ObjectId of the file
104+
* @param mixed $id File ID
105105
* @param resource $destination Writable Stream
106106
* @throws FileNotFoundException
107107
*/
108-
public function downloadToStream(ObjectId $id, $destination)
108+
public function downloadToStream($id, $destination)
109109
{
110110
$file = $this->collectionWrapper->findFileById($id);
111111

@@ -208,11 +208,11 @@ public function getIdFromStream($stream)
208208
/**
209209
* Opens a readable stream for reading a GridFS file.
210210
*
211-
* @param ObjectId $id ObjectId of the file
211+
* @param mixed $id File ID
212212
* @return resource
213213
* @throws FileNotFoundException
214214
*/
215-
public function openDownloadStream(ObjectId $id)
215+
public function openDownloadStream($id)
216216
{
217217
$file = $this->collectionWrapper->findFileById($id);
218218

@@ -291,11 +291,11 @@ public function openUploadStream($filename, array $options = [])
291291
/**
292292
* Renames the GridFS file with the specified ID.
293293
*
294-
* @param ObjectId $id ID of the file to rename
295-
* @param string $newFilename New file name
294+
* @param mixed $id File ID
295+
* @param string $newFilename New file name
296296
* @throws FileNotFoundException
297297
*/
298-
public function rename(ObjectId $id, $newFilename)
298+
public function rename($id, $newFilename)
299299
{
300300
$updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename);
301301

@@ -328,7 +328,7 @@ public function rename(ObjectId $id, $newFilename)
328328
* @param string $filename File name
329329
* @param resource $source Readable stream
330330
* @param array $options Stream options
331-
* @return ObjectId
331+
* @return ObjectId ID of the newly created GridFS file
332332
* @throws InvalidArgumentException
333333
*/
334334
public function uploadFromStream($filename, $source, array $options = [])

0 commit comments

Comments
 (0)