PHP Class Doctrine\ODM\MongoDB\DocumentRepository

This class is designed for inheritance and users can subclass this class to write their own repositories with business-specific methods to locate documents.
Since: 1.0
Author: Jonathan H. Wage ([email protected])
Author: Roman Borschel ([email protected])
Inheritance: implements Doctrine\Common\Persistence\ObjectRepository, implements Doctrine\Common\Collections\Selectable
Afficher le fichier Open project: doctrine/mongodb-odm Class Usage Examples

Protected Properties

Свойство Type Description
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata
$dm DocumentManager
$documentName string
$uow UnitOfWork

Méthodes publiques

Méthode Description
__call ( string $method, array $arguments ) : array | object Adds support for magic finders.
__construct ( DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata ) Initializes this instance with the specified document manager, unit of work and class metadata.
clear ( ) Clears the repository, causing all managed documents to become detached.
createAggregationBuilder ( ) : Builder Creates a new Aggregation\Builder instance that is prepopulated for this document name.
createQueryBuilder ( ) : Builder Creates a new Query\Builder instance that is preconfigured for this document name.
find ( mixed $id, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object | null Finds a document matching the specified identifier. Optionally a lock mode and expected version may be specified.
findAll ( ) : array Finds all documents in the repository.
findBy ( array $criteria, array $sort = null, integer | null $limit = null, integer | null $skip = null ) : array Finds documents by a set of criteria.
findOneBy ( array $criteria ) : object Finds a single document by a set of criteria.
getClassMetadata ( ) : ClassMetadata
getClassName ( ) : string
getDocumentManager ( ) : DocumentManager
getDocumentName ( ) : string
matching ( Doctrine\Common\Collections\Criteria $criteria ) : Doctrine\Common\Collections\Collection Selects all elements from a selectable that match the expression and returns a new collection containing these elements.

Méthodes protégées

Méthode Description
getDocumentPersister ( )

Method Details

__call() public méthode

Adds support for magic finders.
public __call ( string $method, array $arguments ) : array | object
$method string
$arguments array
Résultat array | object The found document/documents.

__construct() public méthode

Initializes this instance with the specified document manager, unit of work and class metadata.
public __construct ( DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata )
$dm DocumentManager The DocumentManager to use.
$uow UnitOfWork The UnitOfWork to use.
$classMetadata Doctrine\ODM\MongoDB\Mapping\ClassMetadata The class metadata.

clear() public méthode

Clears the repository, causing all managed documents to become detached.
public clear ( )

createAggregationBuilder() public méthode

Creates a new Aggregation\Builder instance that is prepopulated for this document name.
public createAggregationBuilder ( ) : Builder
Résultat Doctrine\ODM\MongoDB\Aggregation\Builder

createQueryBuilder() public méthode

Creates a new Query\Builder instance that is preconfigured for this document name.
public createQueryBuilder ( ) : Builder
Résultat Doctrine\ODM\MongoDB\Query\Builder $qb

find() public méthode

Finds a document matching the specified identifier. Optionally a lock mode and expected version may be specified.
public find ( mixed $id, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object | null
$id mixed Identifier.
$lockMode integer Optional. Lock mode; one of the LockMode constants.
$lockVersion integer Optional. Expected version.
Résultat object | null The document, if found, otherwise null.

findAll() public méthode

Finds all documents in the repository.
public findAll ( ) : array
Résultat array

findBy() public méthode

Finds documents by a set of criteria.
public findBy ( array $criteria, array $sort = null, integer | null $limit = null, integer | null $skip = null ) : array
$criteria array Query criteria
$sort array Sort array for Cursor::sort()
$limit integer | null Limit for Cursor::limit()
$skip integer | null Skip for Cursor::skip()
Résultat array

findOneBy() public méthode

Finds a single document by a set of criteria.
public findOneBy ( array $criteria ) : object
$criteria array
Résultat object

getClassMetadata() public méthode

public getClassMetadata ( ) : ClassMetadata
Résultat Doctrine\ODM\MongoDB\Mapping\ClassMetadata

getClassName() public méthode

public getClassName ( ) : string
Résultat string

getDocumentManager() public méthode

public getDocumentManager ( ) : DocumentManager
Résultat DocumentManager

getDocumentName() public méthode

public getDocumentName ( ) : string
Résultat string

getDocumentPersister() protected méthode

protected getDocumentPersister ( )

matching() public méthode

Selects all elements from a selectable that match the expression and returns a new collection containing these elements.
See also: Selectable::matching()
public matching ( Doctrine\Common\Collections\Criteria $criteria ) : Doctrine\Common\Collections\Collection
$criteria Doctrine\Common\Collections\Criteria
Résultat Doctrine\Common\Collections\Collection

Property Details

$class protected_oe property

protected ClassMetadata,Doctrine\ODM\MongoDB\Mapping $class
Résultat Doctrine\ODM\MongoDB\Mapping\ClassMetadata

$dm protected_oe property

protected DocumentManager,Doctrine\ODM\MongoDB $dm
Résultat DocumentManager

$documentName protected_oe property

protected string $documentName
Résultat string

$uow protected_oe property

protected UnitOfWork,Doctrine\ODM\MongoDB $uow
Résultat UnitOfWork