PHP Класс Doctrine\ODM\MongoDB\Persisters\DocumentPersister

С версии: 1.0
Автор: Jonathan H. Wage ([email protected])
Автор: Bulat Shakirzyanov ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__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()