PHP Класс Phalcon\Db\Adapter\MongoDB\GridFS\CollectionWrapper

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $bucketName, array $collectionOptions = [] ) Constructs a GridFS collection wrapper.
deleteChunksByFilesId ( mixed $id ) Deletes all GridFS chunks for a given file ID.
deleteFileAndChunksById ( mixed $id ) Deletes a GridFS file and related chunks by ID.
dropCollections ( ) Drops the GridFS files and chunks collections.
findFileByFilenameAndRevision ( string $filename, integer $revision ) : stdClas\stdClass | null Finds a GridFS file document for a given filename and revision.
findFileById ( mixed $id ) : stdClas\stdClass | null Finds a GridFS file document for a given ID.
findFiles ( array | object $filter, array $options = [] ) : MongoDB\Driver\Cursor Finds documents from the GridFS bucket's files collection.
getChunksCollection ( ) TODO: Remove this
getChunksIteratorByFilesId ( mixed $id ) : IteratorIterator Returns a chunks iterator for a given file ID.
getFilesCollection ( ) TODO: Remove this
insertChunk ( array | object $chunk ) Inserts a document into the chunks collection.
insertFile ( array | object $file ) Inserts a document into the files collection.
updateFilenameForId ( mixed $id, string $filename ) : UpdateResult Updates the filename field in the file document for a given ID.

Приватные методы

Метод Описание
ensureChunksIndex ( ) Create an index on the chunks collection if it does not already exist.
ensureFilesIndex ( ) Create an index on the files collection if it does not already exist.
ensureIndexes ( ) Ensure indexes on the files and chunks collections exist.
isFilesCollectionEmpty ( ) : boolean Returns whether the files collection is empty.

Описание методов

__construct() публичный Метод

Constructs a GridFS collection wrapper.
См. также: Collection::__construct() for supported options
public __construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $bucketName, array $collectionOptions = [] )
$manager MongoDB\Driver\Manager Manager instance from the driver
$databaseName string Database name
$bucketName string Bucket name
$collectionOptions array Collection options

deleteChunksByFilesId() публичный Метод

Deletes all GridFS chunks for a given file ID.
public deleteChunksByFilesId ( mixed $id )
$id mixed

deleteFileAndChunksById() публичный Метод

Deletes a GridFS file and related chunks by ID.
public deleteFileAndChunksById ( mixed $id )
$id mixed

dropCollections() публичный Метод

Drops the GridFS files and chunks collections.
public dropCollections ( )

findFileByFilenameAndRevision() публичный Метод

Revision numbers are defined as follows: * 0 = the original stored file * 1 = the first revision * 2 = the second revision * etc… * -2 = the second most recent revision * -1 = the most recent revision
См. также: Bucket::downloadToStreamByName()
См. также: Bucket::openDownloadStreamByName()
public findFileByFilenameAndRevision ( string $filename, integer $revision ) : stdClas\stdClass | null
$filename string
$revision integer
Результат stdClas\stdClass | null

findFileById() публичный Метод

Finds a GridFS file document for a given ID.
public findFileById ( mixed $id ) : stdClas\stdClass | null
$id mixed
Результат stdClas\stdClass | null

findFiles() публичный Метод

Finds documents from the GridFS bucket's files collection.
См. также: Find::__construct() for supported options
public findFiles ( array | object $filter, array $options = [] ) : MongoDB\Driver\Cursor
$filter array | object Query by which to filter documents
$options array Additional options
Результат MongoDB\Driver\Cursor

getChunksCollection() публичный Метод

TODO: Remove this
public getChunksCollection ( )

getChunksIteratorByFilesId() публичный Метод

Returns a chunks iterator for a given file ID.
public getChunksIteratorByFilesId ( mixed $id ) : IteratorIterator
$id mixed
Результат IteratorIterator

getFilesCollection() публичный Метод

TODO: Remove this
public getFilesCollection ( )

insertChunk() публичный Метод

Inserts a document into the chunks collection.
public insertChunk ( array | object $chunk )
$chunk array | object Chunk document

insertFile() публичный Метод

The file document should be inserted after all chunks have been inserted.
public insertFile ( array | object $file )
$file array | object File document

updateFilenameForId() публичный Метод

Updates the filename field in the file document for a given ID.
public updateFilenameForId ( mixed $id, string $filename ) : UpdateResult
$id mixed
$filename string
Результат Phalcon\Db\Adapter\MongoDB\UpdateResult