PHP Class Doctrine\ODM\CouchDB\UnitOfWork

Since: 1.0
Author: Benjamin Eberlei ([email protected])
Author: Lukas Kahwe Smith ([email protected])
Afficher le fichier Open project: doctrine/couchdb-odm Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( DocumentManager $dm )
computeChangeSet ( ClassMetadata $class, object $document ) : void
contains ( object $document ) : boolean
createDocument ( string $documentName, array $data, array &$hints = [] ) : object Create a document given class, data and the doc-id and revision
detach ( object $document ) Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.
findMany ( array $ids, null | string $documentName = null, null | integer $limit = null, null | integer $offset = null ) : array Find many documents by id.
flush ( ) : void Flush Operation - Write all dirty entries to the CouchDB.
getDocumentIdentifier ( $document )
getDocumentRevision ( object $document ) : string Get the CouchDB revision of the document that was current upon retrieval.
getDocumentState ( object $document ) : integer Get the state of a document.
getIdentityMap ( ) : array Get all entries currently in the identity map
getOriginalData ( object $document ) : array
isInIdentityMap ( object $document ) : boolean Checks whether a document is registered in the identity map of this UnitOfWork.
merge ( $document )
persistNew ( ClassMetadata $class, object $document ) : void Persist new document, marking it managed and generating the id.
refresh ( $document )
registerManaged ( $document, $identifier, $revision )
removeFromIdentityMap ( object $document ) : boolean INTERNAL: Removes an document from the identity map. This effectively detaches the document from the persistence management of Doctrine.
scheduleInsert ( object $document ) Schedule insertion of this document and cascade if neccessary.
scheduleRemove ( $document )
tryGetById ( mixed $id ) : mixed Tries to find an document with the given identifier in the identity map of this UnitOfWork.

Private Methods

Méthode Description
assertValidDocumentType ( $documentName, $document, $type )
cascadeDetach ( object $document, array &$visited ) Cascades a detach operation to associated documents.
cascadeMerge ( object $document, object $managedCopy, array &$visited ) Cascades a merge operation to associated entities.
cascadeRefresh ( $document, &$visited )
cascadeRemove ( $document, &$visited )
cascadeScheduleInsert ( ClassMetadata $class, object $document, array &$visited )
computeAssociationChanges ( array $assoc, mixed $value ) : InvalidArgumentException Computes the changes of an association.
createDocumentAttachments ( string $documentId, array $data ) : array
detectChangedDocuments ( )
doDetach ( object $document, array &$visited ) Executes a detach operation on the given entity.
doMerge ( $document, array &$visited, $prevManagedCopy = null, $assoc = null )
doRefresh ( $document, &$visited )
doRemove ( $document, &$visited )
doScheduleInsert ( $document, &$visited )
getIdGenerator ( $type )
objToStr ( $obj )

Method Details

__construct() public méthode

public __construct ( DocumentManager $dm )
$dm DocumentManager

computeChangeSet() public méthode

public computeChangeSet ( ClassMetadata $class, object $document ) : void
$class Doctrine\ODM\CouchDB\Mapping\ClassMetadata
$document object
Résultat void

contains() public méthode

public contains ( object $document ) : boolean
$document object
Résultat boolean

createDocument() public méthode

Create a document given class, data and the doc-id and revision
public createDocument ( string $documentName, array $data, array &$hints = [] ) : object
$documentName string
$data array
$hints array
Résultat object

detach() public méthode

Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.
public detach ( object $document )
$document object The document to detach.

findMany() public méthode

Important: Each document is returned with the key it has in the $ids array!
public findMany ( array $ids, null | string $documentName = null, null | integer $limit = null, null | integer $offset = null ) : array
$ids array
$documentName null | string
$limit null | integer
$offset null | integer
Résultat array

flush() public méthode

Flush Operation - Write all dirty entries to the CouchDB.
public flush ( ) : void
Résultat void

getDocumentIdentifier() public méthode

public getDocumentIdentifier ( $document )

getDocumentRevision() public méthode

Get the CouchDB revision of the document that was current upon retrieval.
public getDocumentRevision ( object $document ) : string
$document object
Résultat string

getDocumentState() public méthode

Get the state of a document.
public getDocumentState ( object $document ) : integer
$document object
Résultat integer

getIdentityMap() public méthode

Get all entries currently in the identity map
public getIdentityMap ( ) : array
Résultat array

getOriginalData() public méthode

public getOriginalData ( object $document ) : array
$document object
Résultat array

isInIdentityMap() public méthode

Checks whether a document is registered in the identity map of this UnitOfWork.
public isInIdentityMap ( object $document ) : boolean
$document object
Résultat boolean

merge() public méthode

public merge ( $document )

persistNew() public méthode

This method is either called through DocumentManager#persist() or during DocumentManager#flush(), when persistence by reachability is applied.
public persistNew ( ClassMetadata $class, object $document ) : void
$class Doctrine\ODM\CouchDB\Mapping\ClassMetadata
$document object
Résultat void

refresh() public méthode

public refresh ( $document )

registerManaged() public méthode

public registerManaged ( $document, $identifier, $revision )

removeFromIdentityMap() public méthode

INTERNAL: Removes an document from the identity map. This effectively detaches the document from the persistence management of Doctrine.
public removeFromIdentityMap ( object $document ) : boolean
$document object
Résultat boolean

scheduleInsert() public méthode

Schedule insertion of this document and cascade if neccessary.
public scheduleInsert ( object $document )
$document object

scheduleRemove() public méthode

public scheduleRemove ( $document )

tryGetById() public méthode

Tries to find an document with the given identifier in the identity map of this UnitOfWork.
public tryGetById ( mixed $id ) : mixed
$id mixed The document identifier to look for.
Résultat mixed Returns the document with the specified identifier if it exists in this UnitOfWork, FALSE otherwise.