PHP Class Doctrine\OXM\UnitOfWork

This UnitOfWork is only capable of persisting xml class which are mapped via the @XmlRootEntity element. This ensures that @XmlId fields exist, and the persister knows how to save the xml correctly.
Since: 2.0
Author: Richard Fullmer ([email protected])
Inheritance: implements Doctrine\Common\PropertyChangedListener
Afficher le fichier Open project: doctrine/oxm

Méthodes publiques

Méthode Description
__construct ( XmlEntityManager $xem ) Initializes a new UnitOfWork instance, bound to the given EntityManager.
addToIdentityMap ( object $xmlEntity ) : boolean INTERNAL: Registers an document in the identity map.
clear ( ) Clears the UnitOfWork.
commit ( array $options = [] )
detach ( object $xmlEntity ) Detaches an xml-entity from the persistence management. It's persistence will no longer be managed by Doctrine.
getXmlEntityPersister ( string $entityName ) : RootXmlEntityPersister Gets the EntityPersister for an Entity.
getXmlEntityState ( object $xmlEntity, integer $assume = null ) : integer Gets the state of an xml entity within the current unit of work.
isInIdentityMap ( object $entity ) : boolean Checks whether an entity is registered in the identity map of this UnitOfWork.
isScheduledForInsert ( object $entity ) : boolean Checks whether an entity is scheduled for insertion.
merge ( object $xmlEntity ) : object Merges the state of the given detached xml-entity into this UnitOfWork.
persist ( object $xmlEntity ) Persists an xml entity as part of the current unit of work.
propertyChanged ( $entity, string $propertyName, mixed $oldValue, mixed $newValue ) Notifies the listener of a property change.
refresh ( $xmlEntity )
remove ( $xmlEntity )
removeFromIdentityMap ( object $entity ) : boolean INTERNAL: Removes an entity from the identity map. This effectively detaches the entity from the persistence management of Doctrine.
scheduleForDelete ( object $xmlEntity ) INTERNAL: Schedules an entity for deletion.
scheduleForDirtyCheck ( object $xmlEntity ) Schedules a xml entity for dirty-checking at commit-time.
scheduleForInsert ( object $xmlEntity ) Schedules an document for insertion into the database.
tryGetById ( string $id, string $rootClassName ) : mixed INTERNAL: Tries to get an document by its identifier hash. If no document is found for the given hash, FALSE is returned.

Private Methods

Méthode Description
doDetach ( object $xmlEntity, array &$visited ) Executes a detach operation on the given xml-entity.
doPersist ( object $xmlEntity, array &$visited ) Saves an document as part of the current unit of work.
doRefresh ( object $xmlEntity, array &$visited ) Executes a refresh operation on an xml-entity.
doRemove ( $xmlEntity, array &$visited )
executeDeletions ( ClassMetadata $class, array $options = [] ) Executes all document deletions for documents of the specified type.
executeInserts ( ClassMetadata $class, array $options = [] ) Executes all document insertions for documents of the specified type.
executeUpdates ( ClassMetadata $class, array $options = [] ) Executes all xml entity updates for documents of the specified type.
persistNew ( ClassMetadata $class, $xmlEntity ) : void

Method Details

__construct() public méthode

Initializes a new UnitOfWork instance, bound to the given EntityManager.
public __construct ( XmlEntityManager $xem )
$xem XmlEntityManager

addToIdentityMap() public méthode

Note that documents in a hierarchy are registered with the class name of the root document.
public addToIdentityMap ( object $xmlEntity ) : boolean
$xmlEntity 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 ( )

commit() public méthode

public commit ( array $options = [] )
$options array

detach() public méthode

Detaches an xml-entity from the persistence management. It's persistence will no longer be managed by Doctrine.
public detach ( object $xmlEntity )
$xmlEntity object The xml-entity to detach.

getXmlEntityPersister() public méthode

Gets the EntityPersister for an Entity.
public getXmlEntityPersister ( string $entityName ) : RootXmlEntityPersister
$entityName string The name of the Entity.
Résultat Doctrine\OXM\Persisters\RootXmlEntityPersister

getXmlEntityState() public méthode

NOTE: This method sees xml entities that are not MANAGED or REMOVED and have a populated identifier, whether it is generated or manually assigned, as DETACHED. This can be incorrect for manually assigned identifiers.
public getXmlEntityState ( object $xmlEntity, integer $assume = null ) : integer
$xmlEntity object
$assume integer The state to assume if the state is not yet known. This is usually used to avoid costly state lookups, in the worst case with a filesystem lookup.
Résultat integer The document state.

isInIdentityMap() public méthode

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

isScheduledForInsert() public méthode

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

merge() public méthode

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

persist() public méthode

Persists an xml entity as part of the current unit of work.
public persist ( object $xmlEntity )
$xmlEntity object The xml entity to persist.

propertyChanged() public méthode

Notifies the listener of a property change.
public propertyChanged ( $entity, string $propertyName, mixed $oldValue, mixed $newValue )
$propertyName string The name of the property that changed.
$oldValue mixed The old value of the property that changed.
$newValue mixed The new value of the property that changed.

refresh() public méthode

public refresh ( $xmlEntity )

remove() public méthode

public remove ( $xmlEntity )

removeFromIdentityMap() public méthode

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

scheduleForDelete() public méthode

INTERNAL: Schedules an entity for deletion.
public scheduleForDelete ( object $xmlEntity )
$xmlEntity object

scheduleForDirtyCheck() public méthode

Schedules a xml entity for dirty-checking at commit-time.
public scheduleForDirtyCheck ( object $xmlEntity )
$xmlEntity object The xml entity 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 ( object $xmlEntity )
$xmlEntity object The document to schedule for insertion.

tryGetById() public méthode

INTERNAL: Tries to get an document by its identifier hash. If no document is found for the given hash, FALSE is returned.
public tryGetById ( string $id, string $rootClassName ) : mixed
$id string
$rootClassName string
Résultat mixed The found document or FALSE.