PHP Class Doctrine\ODM\MongoDB\UnitOfWork

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

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

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.
Résultat boolean TRUE if the registration was successful, FALSE if the identity of the document in question is already managed.

clear() public méthode

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

clearDocumentChangeSet() public méthode

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

commit() public méthode

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 méthode

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 méthode

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 méthode

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

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.

getById() public méthode

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
Résultat object

getClassNameForAssociation() public méthode

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
Résultat string Class name.

getCollectionPersister() public méthode

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

getDocumentActualData() public méthode

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

getDocumentChangeSet() public méthode

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

getDocumentIdentifier() public méthode

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

getDocumentPersister() public méthode

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

getDocumentState() public méthode

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.
Résultat integer The document state.

getIdentityMap() public méthode

Gets the identity map of the UnitOfWork.
public getIdentityMap ( ) : array
Résultat array

getOrCreateDocument() public méthode

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
Résultat object The document instance.

getOriginalDocumentData() public méthode

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
Résultat array

getOwningDocument() public méthode

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
Résultat object

getParentAssociation() public méthode

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

getPersistenceBuilder() public méthode

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

getScheduledCollectionDeletions() public méthode

Get the currently scheduled complete collection deletions

getScheduledCollectionUpdates() public méthode

Gets the currently scheduled collection inserts, updates and deletes.
public getScheduledCollectionUpdates ( ) : array
Résultat array

getScheduledCollections() public méthode

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

getScheduledDocumentDeletions() public méthode

Gets the currently scheduled document deletions in this UnitOfWork.
public getScheduledDocumentDeletions ( ) : array
Résultat array

getScheduledDocumentInsertions() public méthode

Gets the currently scheduled document insertions in this UnitOfWork.
public getScheduledDocumentInsertions ( ) : array
Résultat array

getScheduledDocumentUpdates() public méthode

Gets the currently scheduled document updates in this UnitOfWork.
public getScheduledDocumentUpdates ( ) : array
Résultat array

getScheduledDocumentUpserts() public méthode

Gets the currently scheduled document upserts in this UnitOfWork.
public getScheduledDocumentUpserts ( ) : array
Résultat array

getVisitedCollections() public méthode

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

hasPendingInsertions() public méthode

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

hasScheduledCollections() public méthode

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

initializeObject() public méthode

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

isCollectionScheduledForDeletion() public méthode

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

isCollectionScheduledForUpdate() public méthode

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

isDocumentScheduled() public méthode

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

isInIdentityMap() public méthode

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

isScheduledForDelete() public méthode

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

isScheduledForDirtyCheck() public méthode

public isScheduledForDirtyCheck ( $document )

isScheduledForInsert() public méthode

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

isScheduledForUpdate() public méthode

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

isScheduledForUpsert() public méthode

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

loadCollection() public méthode

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 méthode

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

merge() public méthode

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

persist() public méthode

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

propertyChanged() public méthode

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 méthode

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 méthode

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 méthode

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 méthode

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

removeFromIdentityMap() public méthode

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
Résultat boolean

scheduleCollectionDeletion() public méthode

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 méthode

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 méthode

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

scheduleForDirtyCheck() public méthode

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

scheduleForInsert() public méthode

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 méthode

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

scheduleForUpsert() public méthode

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 méthode

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 méthode

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

setDocumentPersister() public méthode

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 méthode

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

setOriginalDocumentProperty() public méthode

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 méthode

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 méthode

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

tryGetById() public méthode

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
Résultat mixed The found document or FALSE.

unlock() public méthode

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

unscheduleCollectionDeletion() public méthode

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 méthode

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 méthode

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