class DefaultGridFSRepository extends DocumentRepository implements GridFSRepository (View source)

Properties

protected string $documentName from DocumentRepository
protected DocumentManager $dm from DocumentRepository
protected UnitOfWork $uow from DocumentRepository
protected ClassMetadata $class from DocumentRepository

Methods

__construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata)

Initializes this instance with the specified document manager, unit of work and class metadata.

createQueryBuilder()

Creates a new Query\Builder instance that is preconfigured for this document name.

createAggregationBuilder()

Creates a new Aggregation\Builder instance that is prepopulated for this document name.

clear()

Clears the repository, causing all managed documents to become detached.

find($id, int $lockMode = LockMode::NONE, int|null $lockVersion = null)

Finds a document matching the specified identifier. Optionally a lock mode and expected version may be specified.

findAll()

Finds all documents in the repository.

findBy(array $criteria, array|null $sort = null, $limit = null, $skip = null)

Finds documents by a set of criteria.

findOneBy(array $criteria)

Finds a single document by a set of criteria.

getDocumentName()

No description

getDocumentManager()

No description

getClassMetadata()

No description

getClassName()

No description

matching(Criteria $criteria)

Selects all elements from a selectable that match the expression and returns a new collection containing these elements.

getDocumentPersister()

No description

resource
openDownloadStream(mixed $id)

No description

downloadToStream(mixed $id, resource $destination)

No description

resource
openUploadStream(string $filename, UploadOptions|null $uploadOptions = null)

No description

object
uploadFromStream(string $filename, $source, UploadOptions|null $uploadOptions = null)

No description

object
uploadFromFile(string $source, string|null $filename = null, UploadOptions|null $uploadOptions = null)

Writes the contents of a file to a GridFS file.

Details

__construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata)

Initializes this instance with the specified document manager, unit of work and class metadata.

Parameters

DocumentManager $dm The DocumentManager to use.
UnitOfWork $uow The UnitOfWork to use.
ClassMetadata $classMetadata The class metadata.

createQueryBuilder()

Creates a new Query\Builder instance that is preconfigured for this document name.

createAggregationBuilder()

Creates a new Aggregation\Builder instance that is prepopulated for this document name.

clear()

Clears the repository, causing all managed documents to become detached.

find($id, int $lockMode = LockMode::NONE, int|null $lockVersion = null)

Finds a document matching the specified identifier. Optionally a lock mode and expected version may be specified.

Parameters

$id
int $lockMode
int|null $lockVersion

Exceptions

MappingException
LockException

findAll()

Finds all documents in the repository.

findBy(array $criteria, array|null $sort = null, $limit = null, $skip = null)

Finds documents by a set of criteria.

Parameters

array $criteria
array|null $sort
$limit
$skip

findOneBy(array $criteria)

Finds a single document by a set of criteria.

Parameters

array $criteria

getDocumentName()

getDocumentManager()

getClassMetadata()

getClassName()

matching(Criteria $criteria)

Selects all elements from a selectable that match the expression and returns a new collection containing these elements.

Parameters

Criteria $criteria

See also

Selectable::matching()

protected getDocumentPersister()

resource openDownloadStream(mixed $id)

Parameters

mixed $id File ID

Return Value

resource

See also

Bucket::openDownloadStream()

downloadToStream(mixed $id, resource $destination)

Parameters

mixed $id File ID
resource $destination Writable Stream

See also

Bucket::downloadToStream

resource openUploadStream(string $filename, UploadOptions|null $uploadOptions = null)

Parameters

string $filename
UploadOptions|null $uploadOptions

Return Value

resource

See also

Bucket::openUploadStream

object uploadFromStream(string $filename, $source, UploadOptions|null $uploadOptions = null)

Parameters

string $filename
$source
UploadOptions|null $uploadOptions

Return Value

object The newly created GridFS file

See also

Bucket::uploadFromStream

object uploadFromFile(string $source, string|null $filename = null, UploadOptions|null $uploadOptions = null)

Writes the contents of a file to a GridFS file.

Parameters

string $source
string|null $filename
UploadOptions|null $uploadOptions

Return Value

object The newly created GridFS file