PHP 클래스 Doctrine\ODM\MongoDB\DocumentManager

부터: 1.0
저자: Jonathan H. Wage ([email protected])
저자: Roman Borschel ([email protected])
파일 보기 프로젝트 열기: doctrine/mongodb-odm 1 사용 예제들

공개 메소드들

메소드 설명
clear ( string | null $documentName = null ) Clears the DocumentManager.
close ( ) Closes the DocumentManager. All documents that are currently managed by this DocumentManager become detached. The DocumentManager may no longer be used after it is closed.
contains ( object $document ) : boolean Determines whether a document instance is managed in this DocumentManager.
create ( Connection $conn = null, Configuration $config = null, Doctrine\Common\EventManager $eventManager = null ) : DocumentManager Creates a new Document that operates on the given Mongo connection and uses the given Configuration.
createAggregationBuilder ( string $documentName ) : Builder Creates a new aggregation builder instance for a class.
createDBRef ( mixed $document, array $referenceMapping = null ) : array Returns a DBRef array for the supplied document.
createQueryBuilder ( string $documentName = null ) : Query\Builder Create a new Query instance for a class.
detach ( object $document ) Detaches a document from the DocumentManager, causing a managed document to become detached. Unflushed changes made to the document if any (including removal of the document), will not be synchronized to the database.
find ( string $documentName, mixed $identifier, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object Finds a Document by its identifier.
flush ( object $document = null, array $options = [] ) Flushes all changes to objects that have been queued up to now to the database.
getClassMetadata ( string $className ) : ClassMetadata Returns the metadata for a class.
getConfiguration ( ) : Configuration Gets the Configuration used by the DocumentManager.
getConnection ( ) : Connection Gets the PHP Mongo instance that this DocumentManager wraps.
getDocumentCollection ( string $className ) : Doctrine\MongoDB\Collection Returns the MongoCollection instance for a class.
getDocumentCollections ( ) : array Gets the array of instantiated document collection instances.
getDocumentDatabase ( string $className ) : Doctrine\MongoDB\Database Returns the MongoDB instance for a class.
getDocumentDatabases ( ) : array Gets the array of instantiated document database instances.
getEventManager ( ) : Doctrine\Common\EventManager Gets the EventManager used by the DocumentManager.
getFilterCollection ( ) : Doctrine\ODM\MongoDB\Query\FilterCollection Gets the filter collection.
getHydratorFactory ( ) : Doctrine\ODM\MongoDB\Hydrator\HydratorInterface Gets the Hydrator factory used by the DocumentManager to generate and get hydrators for each type of document.
getMetadataFactory ( ) : ClassMetadataFactory Gets the metadata factory used to gather the metadata of classes.
getPartialReference ( string $documentName, mixed $identifier ) : object Gets a partial reference to the document identified by the given type and identifier without actually loading it, if the document is not yet loaded.
getProxyFactory ( ) : ProxyFactory Gets the proxy factory used by the DocumentManager to create document proxies.
getReference ( string $documentName, string | object $identifier ) : mixed | object Gets a reference to the document identified by the given type and identifier without actually loading it.
getRepository ( string $documentName ) : DocumentRepository Gets the repository for a document class.
getSchemaManager ( ) : SchemaManager Returns SchemaManager, used to create/drop indexes/collections/databases.
getUnitOfWork ( ) : UnitOfWork Gets the UnitOfWork used by the DocumentManager to coordinate operations.
initializeObject ( object $obj ) Helper method to initialize a lazy loading proxy or persistent collection.
isOpen ( ) : boolean Check if the Document manager is open or closed.
lock ( object $document, integer $lockMode, integer $lockVersion = null ) Acquire a lock on the given document.
merge ( object $document ) : object Merges the state of a detached document into the persistence context of this DocumentManager and returns the managed copy of the document.
persist ( object $document ) Tells the DocumentManager to make an instance managed and persistent.
refresh ( object $document ) Refreshes the persistent state of a document from the database, overriding any local changes that have not yet been persisted.
remove ( object $document ) Removes a document instance.
unlock ( object $document ) Releases a lock on the given document.

보호된 메소드들

메소드 설명
__construct ( Connection $conn = null, Configuration $config = null, Doctrine\Common\EventManager $eventManager = null ) Creates a new Document that operates on the given Mongo connection and uses the given Configuration.

비공개 메소드들

메소드 설명
errorIfClosed ( ) Throws an exception if the DocumentManager is closed or currently not active.

메소드 상세

__construct() 보호된 메소드

Creates a new Document that operates on the given Mongo connection and uses the given Configuration.
protected __construct ( Connection $conn = null, Configuration $config = null, Doctrine\Common\EventManager $eventManager = null )
$conn Doctrine\MongoDB\Connection
$config Configuration
$eventManager Doctrine\Common\EventManager

clear() 공개 메소드

All documents that are currently managed by this DocumentManager become detached.
public clear ( string | null $documentName = null )
$documentName string | null if given, only documents of this type will get detached

close() 공개 메소드

Closes the DocumentManager. All documents that are currently managed by this DocumentManager become detached. The DocumentManager may no longer be used after it is closed.
public close ( )

contains() 공개 메소드

Determines whether a document instance is managed in this DocumentManager.
public contains ( object $document ) : boolean
$document object
리턴 boolean TRUE if this DocumentManager currently manages the given document, FALSE otherwise.

create() 공개 정적인 메소드

Creates a new Document that operates on the given Mongo connection and uses the given Configuration.
public static create ( Connection $conn = null, Configuration $config = null, Doctrine\Common\EventManager $eventManager = null ) : DocumentManager
$conn Doctrine\MongoDB\Connection
$config Configuration
$eventManager Doctrine\Common\EventManager
리턴 DocumentManager

createAggregationBuilder() 공개 메소드

Creates a new aggregation builder instance for a class.
public createAggregationBuilder ( string $documentName ) : Builder
$documentName string The document class name.
리턴 Doctrine\ODM\MongoDB\Aggregation\Builder

createDBRef() 공개 메소드

Returns a DBRef array for the supplied document.
public createDBRef ( mixed $document, array $referenceMapping = null ) : array
$document mixed A document object
$referenceMapping array Mapping for the field that references the document
리턴 array A DBRef array

createQueryBuilder() 공개 메소드

Create a new Query instance for a class.
public createQueryBuilder ( string $documentName = null ) : Query\Builder
$documentName string The document class name.
리턴 Query\Builder

detach() 공개 메소드

Documents which previously referenced the detached document will continue to reference it.
public detach ( object $document )
$document object The document to detach.

find() 공개 메소드

This is just a convenient shortcut for getRepository($documentName)->find($id).
public find ( string $documentName, mixed $identifier, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object
$documentName string
$identifier mixed
$lockMode integer
$lockVersion integer
리턴 object $document

flush() 공개 메소드

This effectively synchronizes the in-memory state of managed objects with the database.
public flush ( object $document = null, array $options = [] )
$document object
$options array Array of options to be used with batchInsert(), update() and remove()

getClassMetadata() 공개 메소드

Returns the metadata for a class.
public getClassMetadata ( string $className ) : ClassMetadata
$className string The class name.
리턴 Doctrine\ODM\MongoDB\Mapping\ClassMetadata

getConfiguration() 공개 메소드

Gets the Configuration used by the DocumentManager.
public getConfiguration ( ) : Configuration
리턴 Configuration

getConnection() 공개 메소드

Gets the PHP Mongo instance that this DocumentManager wraps.
public getConnection ( ) : Connection
리턴 Doctrine\MongoDB\Connection

getDocumentCollection() 공개 메소드

Returns the MongoCollection instance for a class.
public getDocumentCollection ( string $className ) : Doctrine\MongoDB\Collection
$className string The class name.
리턴 Doctrine\MongoDB\Collection

getDocumentCollections() 공개 메소드

Gets the array of instantiated document collection instances.
public getDocumentCollections ( ) : array
리턴 array

getDocumentDatabase() 공개 메소드

Returns the MongoDB instance for a class.
public getDocumentDatabase ( string $className ) : Doctrine\MongoDB\Database
$className string The class name.
리턴 Doctrine\MongoDB\Database

getDocumentDatabases() 공개 메소드

Gets the array of instantiated document database instances.
public getDocumentDatabases ( ) : array
리턴 array

getEventManager() 공개 메소드

Gets the EventManager used by the DocumentManager.
public getEventManager ( ) : Doctrine\Common\EventManager
리턴 Doctrine\Common\EventManager

getFilterCollection() 공개 메소드

Gets the filter collection.
public getFilterCollection ( ) : Doctrine\ODM\MongoDB\Query\FilterCollection
리턴 Doctrine\ODM\MongoDB\Query\FilterCollection The active filter collection.

getHydratorFactory() 공개 메소드

Gets the Hydrator factory used by the DocumentManager to generate and get hydrators for each type of document.
public getHydratorFactory ( ) : Doctrine\ODM\MongoDB\Hydrator\HydratorInterface
리턴 Doctrine\ODM\MongoDB\Hydrator\HydratorInterface

getMetadataFactory() 공개 메소드

Gets the metadata factory used to gather the metadata of classes.
public getMetadataFactory ( ) : ClassMetadataFactory
리턴 Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory

getPartialReference() 공개 메소드

The returned reference may be a partial object if the document is not yet loaded/managed. If it is a partial object it will not initialize the rest of the document state on access. Thus you can only ever safely access the identifier of a document obtained through this method. The use-cases for partial references involve maintaining bidirectional associations without loading one side of the association or to update a document without loading it. Note, however, that in the latter case the original (persistent) document data will never be visible to the application (especially not event listeners) as it will never be loaded in the first place.
public getPartialReference ( string $documentName, mixed $identifier ) : object
$documentName string The name of the document type.
$identifier mixed The document identifier.
리턴 object The (partial) document reference.

getProxyFactory() 공개 메소드

Gets the proxy factory used by the DocumentManager to create document proxies.
public getProxyFactory ( ) : ProxyFactory
리턴 Doctrine\ODM\MongoDB\Proxy\ProxyFactory

getReference() 공개 메소드

If partial objects are allowed, this method will return a partial object that only has its identifier populated. Otherwise a proxy is returned that automatically loads itself on first access.
public getReference ( string $documentName, string | object $identifier ) : mixed | object
$documentName string
$identifier string | object
리턴 mixed | object The document reference.

getRepository() 공개 메소드

Gets the repository for a document class.
public getRepository ( string $documentName ) : DocumentRepository
$documentName string The name of the Document.
리턴 DocumentRepository The repository.

getSchemaManager() 공개 메소드

Returns SchemaManager, used to create/drop indexes/collections/databases.
public getSchemaManager ( ) : SchemaManager
리턴 SchemaManager

getUnitOfWork() 공개 메소드

Gets the UnitOfWork used by the DocumentManager to coordinate operations.
public getUnitOfWork ( ) : UnitOfWork
리턴 UnitOfWork

initializeObject() 공개 메소드

This method is a no-op for other objects.
public initializeObject ( object $obj )
$obj object

isOpen() 공개 메소드

Check if the Document manager is open or closed.
public isOpen ( ) : boolean
리턴 boolean

lock() 공개 메소드

Acquire a lock on the given document.
public lock ( object $document, integer $lockMode, integer $lockVersion = null )
$document object
$lockMode integer
$lockVersion integer

merge() 공개 메소드

The document passed to merge will not become associated/managed with this DocumentManager.
public merge ( object $document ) : object
$document object The detached document to merge into the persistence context.
리턴 object The managed copy of the document.

persist() 공개 메소드

The document will be entered into the database at or before transaction commit or as a result of the flush operation. NOTE: The persist operation always considers documents that are not yet known to this DocumentManager as NEW. Do not pass detached documents to the persist operation.
public persist ( object $document )
$document object The instance to make managed and persistent.

refresh() 공개 메소드

Refreshes the persistent state of a document from the database, overriding any local changes that have not yet been persisted.
public refresh ( object $document )
$document object The document to refresh.

remove() 공개 메소드

A removed document will be removed from the database at or before transaction commit or as a result of the flush operation.
public remove ( object $document )
$document object The document instance to remove.

unlock() 공개 메소드

Releases a lock on the given document.
public unlock ( object $document )
$document object