PHP Class Doctrine\ODM\MongoDB\UnitOfWork

Since: 1.0
Author: Jonathan H. Wage ([email protected])
Author: Roman Borschel ([email protected])
Mostrar archivo Open project: doctrine/mongodb-odm Class Usage Examples

Public Methods

Method Description
__construct ( DocumentManager $dm, Doctrine\Common\EventManager $evm, Doctrine\ODM\MongoDB\Hydrator\HydratorFactory $hydratorFactory ) Initializes a new UnitOfWork instance, bound to the given DocumentManager.
addToIdentityMap ( object $document ) : boolean INTERNAL: Registers a document in the identity map.
clear ( string | null $documentName = null ) Clears the UnitOfWork.
clearDocumentChangeSet ( string $oid ) INTERNAL: Clears the property changeset of the document with the given OID.
commit ( object $document = null, array $options = [] ) Commits the UnitOfWork, executing all operations that have been postponed up to this point. The state of all managed documents will be synchronized with the database.
computeChangeSet ( ClassMetadata $class, object $document ) Computes the changes that happened to a single document.
computeChangeSets ( ) Computes all the changes that have been done to documents and collections since the last commit and stores these changes in the _documentChangeSet map temporarily for access by the persisters, until the UoW commit is finished.
containsId ( string $id, string $rootClassName ) : boolean INTERNAL: Checks whether an identifier exists in the identity map.
detach ( object $document ) Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.
getById ( mixed $id, ClassMetadata $class ) : object INTERNAL: Gets a document in the identity map by its identifier hash.
getClassNameForAssociation ( array $mapping, array | null $data ) : string Gets the class name for an association (embed or reference) with respect to any discriminator value.
getCollectionPersister ( ) : CollectionPersister Get the collection persister instance.
getDocumentActualData ( object $document ) : array Get a documents actual data, flattening all the objects to arrays.
getDocumentChangeSet ( object $document ) : array Gets the changeset for a document.
getDocumentIdentifier ( object $document ) : mixed Gets the identifier of a document.
getDocumentPersister ( string $documentName ) : DocumentPersister Get the document persister instance for the given document name
getDocumentState ( object $document, integer | null $assume = null ) : integer Gets the state of a document with regard to the current unit of work.
getIdentityMap ( ) : array Gets the identity map of the UnitOfWork.
getOrCreateDocument ( string $className, array $data, array &$hints = [], object $document = null ) : object INTERNAL: Creates a document. Used for reconstitution of documents during hydration.
getOriginalDocumentData ( object $document ) : array Gets the original data of a document. The original data is the data that was present at the time the document was reconstituted from the database.
getOwningDocument ( object $document ) : object Get the top-most owning document of a given document
getParentAssociation ( object $document ) : array Gets the parent association for a given embedded document.
getPersistenceBuilder ( ) : PersistenceBuilder Factory for returning new PersistenceBuilder instances used for preparing data into queries for insert persistence.
getScheduledCollectionDeletions ( ) : array Get the currently scheduled complete collection deletions
getScheduledCollectionUpdates ( ) : array Gets the currently scheduled collection inserts, updates and deletes.
getScheduledCollections ( object $document ) : array INTERNAL: Gets PersistentCollections that are scheduled to update and related to $document
getScheduledDocumentDeletions ( ) : array Gets the currently scheduled document deletions in this UnitOfWork.
getScheduledDocumentInsertions ( ) : array Gets the currently scheduled document insertions in this UnitOfWork.
getScheduledDocumentUpdates ( ) : array Gets the currently scheduled document updates in this UnitOfWork.
getScheduledDocumentUpserts ( ) : array Gets the currently scheduled document upserts in this UnitOfWork.
getVisitedCollections ( object $document ) : Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface[] INTERNAL: Gets PersistentCollections that have been visited during computing change set of $document
hasPendingInsertions ( ) : boolean Checks whether the UnitOfWork has any pending insertions.
hasScheduledCollections ( object $document ) : boolean Checks whether the document is related to a PersistentCollection scheduled for update or deletion.
initializeObject ( $obj ) : void Helper method to initialize a lazy loading proxy or persistent collection.
isCollectionScheduledForDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) : boolean Checks whether a PersistentCollection is scheduled for deletion.
isCollectionScheduledForUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) : boolean Checks whether a PersistentCollection is scheduled for update.
isDocumentScheduled ( $document ) : boolean Checks whether a document is scheduled for insertion, update or deletion.
isInIdentityMap ( object $document ) : boolean Checks whether a document is registered in the identity map.
isScheduledForDelete ( object $document ) : boolean Checks whether a document is registered as removed/deleted with the unit of work.
isScheduledForDirtyCheck ( $document )
isScheduledForInsert ( object $document ) : boolean Checks whether a document is scheduled for insertion.
isScheduledForUpdate ( object $document ) : boolean Checks whether a document is registered as dirty in the unit of work.
isScheduledForUpsert ( object $document ) : boolean Checks whether a document is scheduled for upsert.
loadCollection ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $collection ) Initializes (loads) an uninitialized persistent collection of a document.
lock ( object $document, integer $lockMode, integer $lockVersion = null ) Acquire a lock on the given document.
merge ( object $document ) : object Merges the state of the given detached document into this UnitOfWork.
persist ( object $document ) Persists a document as part of the current unit of work.
propertyChanged ( object $document, string $propertyName, mixed $oldValue, mixed $newValue ) Notifies this UnitOfWork of a property change in a document.
recomputeSingleDocumentChangeSet ( ClassMetadata $class, object $document ) INTERNAL: Computes the changeset of an individual document, independently of the computeChangeSets() routine that is used at the beginning of a UnitOfWork#commit().
refresh ( object $document ) Refreshes the state of the given document from the database, overwriting any local, unpersisted changes.
registerManaged ( object $document, array $id, array $data ) INTERNAL: Registers a document as managed.
remove ( object $document ) Deletes a document as part of the current unit of work.
removeFromIdentityMap ( object $document ) : boolean INTERNAL: Removes a document from the identity map. This effectively detaches the document from the persistence management of Doctrine.
scheduleCollectionDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) INTERNAL: Schedules a complete collection for removal when this UnitOfWork commits.
scheduleCollectionUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) INTERNAL: Schedules a collection for update when this UnitOfWork commits.
scheduleForDelete ( object $document ) INTERNAL: Schedules a document for deletion.
scheduleForDirtyCheck ( object $document ) Schedules a document for dirty-checking at commit-time.
scheduleForInsert ( ClassMetadata $class, object $document ) Schedules a document for insertion into the database.
scheduleForUpdate ( object $document ) Schedules a document for being updated.
scheduleForUpsert ( ClassMetadata $class, object $document ) Schedules a document for upsert into the database and adds it to the identity map
scheduleOrphanRemoval ( object $document ) INTERNAL: Schedules an embedded document for removal. The remove() operation will be invoked on that document at the beginning of the next commit of this UnitOfWork.
setDocumentChangeSet ( object $document, array $changeset ) INTERNAL: Sets the changeset for a document.
setDocumentPersister ( string $documentName, DocumentPersister $persister ) Set the document persister instance to use for the given document name
setOriginalDocumentData ( $document, array $data )
setOriginalDocumentProperty ( string $oid, string $property, mixed $value ) INTERNAL: Sets a property value of the original data array of a document.
setParentAssociation ( object $document, array $mapping, object $parent, string $propertyPath ) Sets the parent association for a given embedded document.
size ( ) : integer Calculates the size of the UnitOfWork. The size of the UnitOfWork is the number of documents in the identity map.
tryGetById ( mixed $id, ClassMetadata $class ) : mixed INTERNAL: Tries to get a document by its identifier hash. If no document is found for the given hash, FALSE is returned.
unlock ( object $document ) Releases a lock on the given document.
unscheduleCollectionDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) INTERNAL: Unschedules a collection from being deleted when this UnitOfWork commits.
unscheduleCollectionUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) INTERNAL: Unschedules a collection from being updated when this UnitOfWork commits.
unscheduleOrphanRemoval ( object $document ) INTERNAL: Unschedules an embedded or referenced object for removal.

Private Methods

Method Description
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 documents.
cascadePersist ( object $document, array &$visited ) Cascades the save operation to associated documents.
cascadeRefresh ( object $document, array &$visited ) Cascades a refresh operation to associated documents.
cascadeRemove ( object $document, array &$visited ) Cascades the delete operation to associated documents.
computeAssociationChanges ( object $parentDocument, array $assoc, mixed $value ) Computes the changes of an association.
computeOrRecomputeChangeSet ( ClassMetadata $class, object $document, boolean $recompute = false ) Used to do the common work of computeChangeSet and recomputeSingleDocumentChangeSet
computeScheduleInsertsChangeSets ( ) Compute changesets of all documents scheduled for insertion.
computeScheduleUpsertsChangeSets ( ) Compute changesets of all documents scheduled for upsert.
computeSingleDocumentChangeSet ( object $document ) : void Only flush the given document according to a ruleset that keeps the UoW consistent.
doDetach ( object $document, array &$visited ) Executes a detach operation on the given document.
doMerge ( object $document, array &$visited, object | null $prevManagedCopy = null, array | null $assoc = null ) : object Executes a merge operation on a document.
doPersist ( object $document, array &$visited ) Saves a document as part of the current unit of work.
doRefresh ( object $document, array &$visited ) Executes a refresh operation on a document.
doRemove ( object $document, array &$visited ) Deletes a document as part of the current unit of work.
executeDeletions ( ClassMetadata $class, array $documents, array $options = [] ) Executes all document deletions for documents of the specified type.
executeInserts ( ClassMetadata $class, array $documents, array $options = [] ) Executes all document insertions for documents of the specified type.
executeUpdates ( ClassMetadata $class, array $documents, array $options = [] ) Executes all document updates for documents of the specified type.
executeUpserts ( ClassMetadata $class, array $documents, array $options = [] ) Executes all document upserts for documents of the specified type.
fixPersistentCollectionOwnership ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll, object $document, ClassMetadata $class, string $propName ) : Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface Fixes PersistentCollection state if it wasn't used exactly as we had in mind: 1) sets owner if it was cloned 2) clones collection, sets owner, updates document's property and, if necessary, updates originalData 3) NOP if state is OK Returned collection should be used from now on (only important with 2nd point)
getClassesForCommitAction ( array $documents, boolean $includeEmbedded = false ) : array Groups a list of scheduled documents by their class.
getIdForIdentityMap ( object $document ) : string
objToStr ( $obj )
persistNew ( ClassMetadata $class, object $document )
scheduleCollectionOwner ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) Marks the PersistentCollection's top-level owner as having a relation to a collection scheduled for update or deletion.

Method Details

__construct() public method

Initializes a new UnitOfWork instance, bound to the given DocumentManager.
public __construct ( DocumentManager $dm, Doctrine\Common\EventManager $evm, Doctrine\ODM\MongoDB\Hydrator\HydratorFactory $hydratorFactory )
$dm DocumentManager
$evm Doctrine\Common\EventManager
$hydratorFactory Doctrine\ODM\MongoDB\Hydrator\HydratorFactory

addToIdentityMap() public method

Note that documents in a hierarchy are registered with the class name of the root document. Identifiers are serialized before being used as array keys to allow differentiation of equal, but not identical, values.
public addToIdentityMap ( object $document ) : boolean
$document object The document to register.
return boolean TRUE if the registration was successful, FALSE if the identity of the document in question is already managed.

clear() public method

Clears the UnitOfWork.
public clear ( string | null $documentName = null )
$documentName string | null if given, only documents of this type will get detached.

clearDocumentChangeSet() public method

INTERNAL: Clears the property changeset of the document with the given OID.
public clearDocumentChangeSet ( string $oid )
$oid string The document's OID.

commit() public method

The operations are executed in the following order: 1) All document insertions 2) All document updates 3) All document deletions
public commit ( object $document = null, array $options = [] )
$document object
$options array Array of options to be used with batchInsert(), update() and remove()

computeChangeSet() public method

Modifies/populates the following properties: {@link originalDocumentData} If the document is NEW or MANAGED but not yet fully persisted (only has an id) then it was not fetched from the database and therefore we have no original document data yet. All of the current document data is stored as the original document data. {@link documentChangeSets} The changes detected on all properties of the document are stored there. A change is a tuple array where the first entry is the old value and the second entry is the new value of the property. Changesets are used by persisters to INSERT/UPDATE the persistent document state. {@link documentUpdates} If the document is already fully MANAGED (has been fetched from the database before) and any changes to its properties are detected, then a reference to the document is stored there to mark it for an update.
public computeChangeSet ( ClassMetadata $class, object $document )
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata The class descriptor of the document.
$document object The document for which to compute the changes.

computeChangeSets() public method

Computes all the changes that have been done to documents and collections since the last commit and stores these changes in the _documentChangeSet map temporarily for access by the persisters, until the UoW commit is finished.
public computeChangeSets ( )

containsId() public method

INTERNAL: Checks whether an identifier exists in the identity map.
public containsId ( string $id, string $rootClassName ) : boolean
$id string
$rootClassName string
return boolean

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.

getById() public method

INTERNAL: Gets a document in the identity map by its identifier hash.
public getById ( mixed $id, ClassMetadata $class ) : object
$id mixed Document identifier
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata Document class
return object

getClassNameForAssociation() public method

Gets the class name for an association (embed or reference) with respect to any discriminator value.
public getClassNameForAssociation ( array $mapping, array | null $data ) : string
$mapping array Field mapping for the association
$data array | null Data for the embedded document or reference
return string Class name.

getCollectionPersister() public method

Get the collection persister instance.
public getCollectionPersister ( ) : CollectionPersister
return Doctrine\ODM\MongoDB\Persisters\CollectionPersister

getDocumentActualData() public method

Get a documents actual data, flattening all the objects to arrays.
public getDocumentActualData ( object $document ) : array
$document object
return array

getDocumentChangeSet() public method

Gets the changeset for a document.
public getDocumentChangeSet ( object $document ) : array
$document object
return array array('property' => array(0 => mixed|null, 1 => mixed|null))

getDocumentIdentifier() public method

Gets the identifier of a document.
public getDocumentIdentifier ( object $document ) : mixed
$document object
return mixed The identifier value

getDocumentPersister() public method

Get the document persister instance for the given document name
public getDocumentPersister ( string $documentName ) : DocumentPersister
$documentName string
return Doctrine\ODM\MongoDB\Persisters\DocumentPersister

getDocumentState() public method

Gets the state of a document with regard to the current unit of work.
public getDocumentState ( object $document, integer | null $assume = null ) : integer
$document object
$assume integer | null The state to assume if the state is not yet known (not MANAGED or REMOVED). This parameter can be set to improve performance of document state detection by potentially avoiding a database lookup if the distinction between NEW and DETACHED is either known or does not matter for the caller of the method.
return integer The document state.

getIdentityMap() public method

Gets the identity map of the UnitOfWork.
public getIdentityMap ( ) : array
return array

getOrCreateDocument() public method

INTERNAL: Creates a document. Used for reconstitution of documents during hydration.
public getOrCreateDocument ( string $className, array $data, array &$hints = [], object $document = null ) : object
$className string The name of the document class.
$data array The data for the document.
$hints array Any hints to account for during reconstitution/lookup of the document.
$document object The document to be hydrated into in case of creation
return object The document instance.

getOriginalDocumentData() public method

Gets the original data of a document. The original data is the data that was present at the time the document was reconstituted from the database.
public getOriginalDocumentData ( object $document ) : array
$document object
return array

getOwningDocument() public method

If a top-level document is provided, that same document will be returned. For an embedded document, we will walk through parent associations until we find a top-level document.
public getOwningDocument ( object $document ) : object
$document object
return object

getParentAssociation() public method

list($mapping, $parent, $propertyPath) = $this->getParentAssociation($embeddedDocument);
public getParentAssociation ( object $document ) : array
$document object
return array $association

getPersistenceBuilder() public method

Factory for returning new PersistenceBuilder instances used for preparing data into queries for insert persistence.
public getPersistenceBuilder ( ) : PersistenceBuilder
return Doctrine\ODM\MongoDB\Persisters\PersistenceBuilder $pb

getScheduledCollectionDeletions() public method

Get the currently scheduled complete collection deletions

getScheduledCollectionUpdates() public method

Gets the currently scheduled collection inserts, updates and deletes.

getScheduledCollections() public method

INTERNAL: Gets PersistentCollections that are scheduled to update and related to $document
public getScheduledCollections ( object $document ) : array
$document object
return array

getScheduledDocumentDeletions() public method

Gets the currently scheduled document deletions in this UnitOfWork.

getScheduledDocumentInsertions() public method

Gets the currently scheduled document insertions in this UnitOfWork.

getScheduledDocumentUpdates() public method

Gets the currently scheduled document updates in this UnitOfWork.

getScheduledDocumentUpserts() public method

Gets the currently scheduled document upserts in this UnitOfWork.

getVisitedCollections() public method

INTERNAL: Gets PersistentCollections that have been visited during computing change set of $document
public getVisitedCollections ( object $document ) : Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface[]
$document object
return Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface[]

hasPendingInsertions() public method

Checks whether the UnitOfWork has any pending insertions.
public hasPendingInsertions ( ) : boolean
return boolean TRUE if this UnitOfWork has pending insertions, FALSE otherwise.

hasScheduledCollections() public method

Checks whether the document is related to a PersistentCollection scheduled for update or deletion.
public hasScheduledCollections ( object $document ) : boolean
$document object
return boolean

initializeObject() public method

Helper method to initialize a lazy loading proxy or persistent collection.
public initializeObject ( $obj ) : void
return void

isCollectionScheduledForDeletion() public method

Checks whether a PersistentCollection is scheduled for deletion.
public isCollectionScheduledForDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) : boolean
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface
return boolean

isCollectionScheduledForUpdate() public method

Checks whether a PersistentCollection is scheduled for update.
public isCollectionScheduledForUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) : boolean
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface
return boolean

isDocumentScheduled() public method

Checks whether a document is scheduled for insertion, update or deletion.
public isDocumentScheduled ( $document ) : boolean
$document
return boolean

isInIdentityMap() public method

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

isScheduledForDelete() public method

Checks whether a document is registered as removed/deleted with the unit of work.
public isScheduledForDelete ( object $document ) : boolean
$document object
return boolean

isScheduledForDirtyCheck() public method

public isScheduledForDirtyCheck ( $document )

isScheduledForInsert() public method

Checks whether a document is scheduled for insertion.
public isScheduledForInsert ( object $document ) : boolean
$document object
return boolean

isScheduledForUpdate() public method

Note: Is not very useful currently as dirty documents are only registered at commit time.
public isScheduledForUpdate ( object $document ) : boolean
$document object
return boolean

isScheduledForUpsert() public method

Checks whether a document is scheduled for upsert.
public isScheduledForUpsert ( object $document ) : boolean
$document object
return boolean

loadCollection() public method

Initializes (loads) an uninitialized persistent collection of a document.
public loadCollection ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $collection )
$collection Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface The collection to initialize.

lock() public method

Acquire a lock on the given document.
public lock ( object $document, integer $lockMode, integer $lockVersion = null )
$document object
$lockMode integer
$lockVersion integer

merge() public method

Merges the state of the given detached document into this UnitOfWork.
public merge ( object $document ) : object
$document object
return object The managed copy of the document.

persist() public method

Persists a document as part of the current unit of work.
public persist ( object $document )
$document object The document to persist.

propertyChanged() public method

Notifies this UnitOfWork of a property change in a document.
public propertyChanged ( object $document, string $propertyName, mixed $oldValue, mixed $newValue )
$document object The document that owns the property.
$propertyName string The name of the property that changed.
$oldValue mixed The old value of the property.
$newValue mixed The new value of the property.

recomputeSingleDocumentChangeSet() public method

The passed document must be a managed document. If the document already has a change set because this method is invoked during a commit cycle then the change sets are added. whereby changes detected in this method prevail.
public recomputeSingleDocumentChangeSet ( ClassMetadata $class, object $document )
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata The class descriptor of the document.
$document object The document for which to (re)calculate the change set.

refresh() public method

Refreshes the state of the given document from the database, overwriting any local, unpersisted changes.
public refresh ( object $document )
$document object The document to refresh.

registerManaged() public method

TODO: This method assumes that $id is a valid PHP identifier for the document class. If the class expects its database identifier to be a MongoId, and an incompatible $id is registered (e.g. an integer), the document identifiers map will become inconsistent with the identity map. In the future, we may want to round-trip $id through a PHP and database conversion and throw an exception if it's inconsistent.
public registerManaged ( object $document, array $id, array $data )
$document object The document.
$id array The identifier values.
$data array The original document data.

remove() public method

Deletes a document as part of the current unit of work.
public remove ( object $document )
$document object The document to remove.

removeFromIdentityMap() public method

INTERNAL: Removes a 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

scheduleCollectionDeletion() public method

INTERNAL: Schedules a complete collection for removal when this UnitOfWork commits.
public scheduleCollectionDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll )
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface

scheduleCollectionUpdate() public method

INTERNAL: Schedules a collection for update when this UnitOfWork commits.
public scheduleCollectionUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll )
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface

scheduleForDelete() public method

INTERNAL: Schedules a document for deletion.
public scheduleForDelete ( object $document )
$document object

scheduleForDirtyCheck() public method

Schedules a document for dirty-checking at commit-time.
public scheduleForDirtyCheck ( object $document )
$document object The document to schedule for dirty-checking.

scheduleForInsert() public method

If the document already has an identifier, it will be added to the identity map.
public scheduleForInsert ( ClassMetadata $class, object $document )
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata
$document object The document to schedule for insertion.

scheduleForUpdate() public method

Schedules a document for being updated.
public scheduleForUpdate ( object $document )
$document object The document to schedule for being updated.

scheduleForUpsert() public method

Schedules a document for upsert into the database and adds it to the identity map
public scheduleForUpsert ( ClassMetadata $class, object $document )
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata
$document object The document to schedule for upsert.

scheduleOrphanRemoval() public method

INTERNAL: Schedules an embedded document for removal. The remove() operation will be invoked on that document at the beginning of the next commit of this UnitOfWork.
public scheduleOrphanRemoval ( object $document )
$document object

setDocumentChangeSet() public method

INTERNAL: Sets the changeset for a document.
public setDocumentChangeSet ( object $document, array $changeset )
$document object
$changeset array

setDocumentPersister() public method

Set the document persister instance to use for the given document name
public setDocumentPersister ( string $documentName, DocumentPersister $persister )
$documentName string
$persister Doctrine\ODM\MongoDB\Persisters\DocumentPersister

setOriginalDocumentData() public method

public setOriginalDocumentData ( $document, array $data )
$data array

setOriginalDocumentProperty() public method

INTERNAL: Sets a property value of the original data array of a document.
public setOriginalDocumentProperty ( string $oid, string $property, mixed $value )
$oid string
$property string
$value mixed

setParentAssociation() public method

Sets the parent association for a given embedded document.
public setParentAssociation ( object $document, array $mapping, object $parent, string $propertyPath )
$document object
$mapping array
$parent object
$propertyPath string

size() public method

Calculates the size of the UnitOfWork. The size of the UnitOfWork is the number of documents in the identity map.
public size ( ) : integer
return integer

tryGetById() public method

INTERNAL: Tries to get a document by its identifier hash. If no document is found for the given hash, FALSE is returned.
public tryGetById ( mixed $id, ClassMetadata $class ) : mixed
$id mixed Document identifier
$class Doctrine\ODM\MongoDB\Mapping\ClassMetadata Document class
return mixed The found document or FALSE.

unlock() public method

Releases a lock on the given document.
public unlock ( object $document )
$document object

unscheduleCollectionDeletion() public method

INTERNAL: Unschedules a collection from being deleted when this UnitOfWork commits.
public unscheduleCollectionDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll )
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface

unscheduleCollectionUpdate() public method

INTERNAL: Unschedules a collection from being updated when this UnitOfWork commits.
public unscheduleCollectionUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll )
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface

unscheduleOrphanRemoval() public method

INTERNAL: Unschedules an embedded or referenced object for removal.
public unscheduleOrphanRemoval ( object $document )
$document object