PHP 클래스 Doctrine\ODM\MongoDB\Persisters\DocumentPersister

부터: 1.0
저자: Jonathan H. Wage ([email protected])
저자: Bulat Shakirzyanov ([email protected])
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( PersistenceBuilder $pb, DocumentManager $dm, ClassMetadata $class ) Initializes a new DocumentPersister instance.
addInsert ( object $document ) Adds a document to the queued insertions.
delete ( mixed $document, array $options = [] ) Removes document from mongo
executeInserts ( array $options = [] ) : array Executes all queued document insertions and returns any generated post-insert identifiers that were created as a result of the insertions.
exists ( object $document ) : boolean Checks whether the given managed document exists in the database.
getClassMetadata ( ) : ClassMetadata Gets the ClassMetadata instance of the document class this persister is used for.
load ( array $criteria, object $document = null, array $hints = [], integer $lockMode ) : object Loads an document by a list of field criteria.
loadAll ( array $criteria = [] ) : array Loads a list of documents by a list of field criteria.
loadCollection ( PersistentCollection $collection )
lock ( object $document, integer $lockMode ) Locks document by storing the lock mode on the mapped lock field.
prepareQuery ( string | array $query ) : array Prepares a query and converts values to the types mongodb expects.
refresh ( array $id, object $document ) Refreshes a managed document.
unlock ( object $document ) Releases any lock that exists on this document.
update ( object $document, array $options = [] ) Updates the already persisted document if it has any new changesets.

비공개 메소드들

메소드 설명
createDocument ( $result, object $document = null, array $hints = [] ) : object Creates or fills a single document object from an query result.
getClassDiscriminatorValues ( ClassMetadata $metadata ) : array Gets the array of discriminator values for the given ClassMetadata
prepareWhereValue ( string &$fieldName, string $value ) : string Prepare where values converting document object field names to the document collection field name.

메소드 상세

__construct() 공개 메소드

Initializes a new DocumentPersister instance.
public __construct ( PersistenceBuilder $pb, DocumentManager $dm, ClassMetadata $class )
$pb PersistenceBuilder
$dm Doctrine\ODM\MongoDB\DocumentManager
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata

addInsert() 공개 메소드

The document remains queued until {@link executeInserts} is invoked.
public addInsert ( object $document )
$document object The document to queue for insertion.

delete() 공개 메소드

Removes document from mongo
public delete ( mixed $document, array $options = [] )
$document mixed
$options array Array of options to be used with remove()

executeInserts() 공개 메소드

If no inserts are queued, invoking this method is a NOOP.
public executeInserts ( array $options = [] ) : array
$options array Array of options to be used with batchInsert()
리턴 array An array of any generated post-insert IDs. This will be an empty array if the document class does not use the IDENTITY generation strategy.

exists() 공개 메소드

Checks whether the given managed document exists in the database.
public exists ( object $document ) : boolean
$document object
리턴 boolean TRUE if the document exists in the database, FALSE otherwise.

getClassMetadata() 공개 메소드

Gets the ClassMetadata instance of the document class this persister is used for.
public getClassMetadata ( ) : ClassMetadata
리턴 Doctrine\ODM\MongoDB\Mapping\ClassMetadata

load() 공개 메소드

Loads an document by a list of field criteria.
public load ( array $criteria, object $document = null, array $hints = [], integer $lockMode ) : object
$criteria array The criteria by which to load the document.
$document object The document to load the data into. If not specified, a new document is created.
$hints array Hints for document creation.
$lockMode integer
리턴 object The loaded and managed document instance or NULL if the document can not be found.

loadAll() 공개 메소드

Loads a list of documents by a list of field criteria.
public loadAll ( array $criteria = [] ) : array
$criteria array
리턴 array

loadCollection() 공개 메소드

public loadCollection ( PersistentCollection $collection )
$collection Doctrine\ODM\MongoDB\PersistentCollection

lock() 공개 메소드

Locks document by storing the lock mode on the mapped lock field.
public lock ( object $document, integer $lockMode )
$document object
$lockMode integer

prepareQuery() 공개 메소드

Prepares a query and converts values to the types mongodb expects.
public prepareQuery ( string | array $query ) : array
$query string | array
리턴 array $query

refresh() 공개 메소드

Refreshes a managed document.
public refresh ( array $id, object $document )
$id array The identifier of the document.
$document object The document to refresh.

unlock() 공개 메소드

Releases any lock that exists on this document.
public unlock ( object $document )
$document object

update() 공개 메소드

Updates the already persisted document if it has any new changesets.
public update ( object $document, array $options = [] )
$document object
$options array Array of options to be used with update()