PHP Class Doctrine\ODM\CouchDB\UnitOfWork

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

Public Methods

Method 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

Method 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 method

public __construct ( DocumentManager $dm )
$dm DocumentManager

computeChangeSet() public method

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

contains() public method

public contains ( object $document ) : boolean
$document object
return boolean

createDocument() public method

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
return object

detach() public method

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 method

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
return array

flush() public method

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

getDocumentIdentifier() public method

public getDocumentIdentifier ( $document )

getDocumentRevision() public method

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

getDocumentState() public method

Get the state of a document.
public getDocumentState ( object $document ) : integer
$document object
return integer

getIdentityMap() public method

Get all entries currently in the identity map
public getIdentityMap ( ) : array
return array

getOriginalData() public method

public getOriginalData ( object $document ) : array
$document object
return array

isInIdentityMap() public method

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

merge() public method

public merge ( $document )

persistNew() public method

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
return void

refresh() public method

public refresh ( $document )

registerManaged() public method

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

removeFromIdentityMap() public method

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
return boolean

scheduleInsert() public method

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

scheduleRemove() public method

public scheduleRemove ( $document )

tryGetById() public method

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.
return mixed Returns the document with the specified identifier if it exists in this UnitOfWork, FALSE otherwise.