class UnitOfWork (View source)

Unit of work class

Constants

STATE_NEW

STATE_MANAGED

STATE_REMOVED

STATE_DETACHED

Methods

__construct(DocumentManager $dm)

No description

object
createDocument(string $documentName, array $data, array $hints = array())

Create a document given class, data and the doc-id and revision

array
getOriginalData(object $document)

No description

scheduleInsert(object $document)

Schedule insertion of this document and cascade if neccessary.

scheduleRemove($document)

No description

refresh($document)

No description

merge($document)

No description

detach(object $document)

Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.

int
getDocumentState(object $document)

Get the state of a document.

void
computeChangeSet(ClassMetadata $class, object $document)

No description

void
persistNew(ClassMetadata $class, object $document)

Persist new document, marking it managed and generating the id.

void
flush()

Flush Operation - Write all dirty entries to the CouchDB.

boolean
removeFromIdentityMap(object $document)

INTERNAL: Removes an document from the identity map. This effectively detaches the document from the persistence management of Doctrine.

bool
contains(object $document)

No description

registerManaged($document, $identifier, $revision)

No description

mixed
tryGetById(mixed $id)

Tries to find an document with the given identifier in the identity map of this UnitOfWork.

boolean
isInIdentityMap(object $document)

Checks whether a document is registered in the identity map of this UnitOfWork.

string
getDocumentRevision(object $document)

Get the CouchDB revision of the document that was current upon retrieval.

getDocumentIdentifier($document)

No description

array
findMany(array $ids, null|string $documentName = null, null|int $limit = null, null|int $offset = null)

Find many documents by id.

array
getIdentityMap()

Get all entries currently in the identity map

Details

__construct(DocumentManager $dm)

Parameters

DocumentManager $dm

object createDocument(string $documentName, array $data, array $hints = array())

Create a document given class, data and the doc-id and revision

Parameters

string $documentName
array $data
array $hints

Return Value

object

Exceptions

InvalidArgumentException
InvalidDocumentTypeException

array getOriginalData(object $document)

Parameters

object $document

Return Value

array

scheduleInsert(object $document)

Schedule insertion of this document and cascade if neccessary.

Parameters

object $document

scheduleRemove($document)

Parameters

$document

refresh($document)

Parameters

$document

merge($document)

Parameters

$document

detach(object $document)

Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.

Parameters

object $document The document to detach.

int getDocumentState(object $document)

Get the state of a document.

Parameters

object $document

Return Value

int

void computeChangeSet(ClassMetadata $class, object $document)

Parameters

ClassMetadata $class
object $document

Return Value

void

void persistNew(ClassMetadata $class, object $document)

Persist new document, marking it managed and generating the id.

This method is either called through DocumentManager#persist() or during DocumentManager#flush(), when persistence by reachability is applied.

Parameters

ClassMetadata $class
object $document

Return Value

void

void flush()

Flush Operation - Write all dirty entries to the CouchDB.

Return Value

void

Exceptions

UpdateConflictException
CouchDBException
HTTPException
DocumentNotFoundException

boolean removeFromIdentityMap(object $document)

INTERNAL: Removes an document from the identity map. This effectively detaches the document from the persistence management of Doctrine.

Parameters

object $document

Return Value

boolean

bool contains(object $document)

Parameters

object $document

Return Value

bool

registerManaged($document, $identifier, $revision)

Parameters

$document
$identifier
$revision

mixed tryGetById(mixed $id)

Tries to find an document with the given identifier in the identity map of this UnitOfWork.

Parameters

mixed $id The document identifier to look for.

Return Value

mixed Returns the document with the specified identifier if it exists in this UnitOfWork, FALSE otherwise.

boolean isInIdentityMap(object $document)

Checks whether a document is registered in the identity map of this UnitOfWork.

Parameters

object $document

Return Value

boolean

string getDocumentRevision(object $document)

Get the CouchDB revision of the document that was current upon retrieval.

Parameters

object $document

Return Value

string

Exceptions

CouchDBException

getDocumentIdentifier($document)

Parameters

$document

array findMany(array $ids, null|string $documentName = null, null|int $limit = null, null|int $offset = null)

Find many documents by id.

Important: Each document is returned with the key it has in the $ids array!

Parameters

array $ids
null|string $documentName
null|int $limit
null|int $offset

Return Value

array

Exceptions

Exception

array getIdentityMap()

Get all entries currently in the identity map

Return Value

array