Transaction Interface Reference

Detailed Description

Transaction implements the Unit of Work pattern as it defines the interface for maintaining a list of PersistentObject changes inside a business transaction and commit/rollback them.

Transaction also serves as an Identity Map for loaded objects.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 21 of file Transaction.php.

+ Inheritance diagram for Transaction:

Public Member Functions

 registerLoaded (PersistentObject $object)
 
 registerNew (PersistentObject $object)
 
 registerDirty (PersistentObject $object)
 
 registerDeleted (PersistentObject $object)
 
 begin ()
 
 commit ()
 
 rollback ()
 
 isActive ()
 
 getLoaded (ObjectId $oid)
 
 detach (ObjectId $oid)
 
 getObjects ()
 

Member Function Documentation

registerLoaded ( PersistentObject  $object)

Register a loaded object.

Mappers must call this method on each loaded object. The returned object is the registered instance.

Parameters
$objectPersistentObject instance
Returns
PersistentObject instance

Implemented in DefaultTransaction.

registerNew ( PersistentObject  $object)

Register a newly created object.

Parameters
$objectPersistentObject instance

Implemented in DefaultTransaction.

registerDirty ( PersistentObject  $object)

Register a dirty object.

Parameters
$objectPersistentObject instance

Implemented in DefaultTransaction.

registerDeleted ( PersistentObject  $object)

Register a deleted object.

Parameters
$objectPersistentObject instance

Implemented in DefaultTransaction.

begin ( )

Set the transaction active (object changes will be recorded).

Implemented in DefaultTransaction.

commit ( )

Commit the object changes to the storage.

Sets the transaction to inactive.

Returns
Map of oid changes (key: oid string before commit, value: oid string after commit)

Implemented in DefaultTransaction.

rollback ( )

Discard the object changes.

Sets the transaction to inactive.

Implemented in DefaultTransaction.

isActive ( )

Check if the transaction is active.

Returns
Boolean

Implemented in DefaultTransaction.

getLoaded ( ObjectId  $oid)

Get a loaded object.

Parameters
$oidObjectId of the object
Returns
PersistentObject instance or null if not loaded yet

Implemented in DefaultTransaction.

detach ( ObjectId  $oid)

Detach an object from the transaction.

All local changes will not be stored. Afterwards the object is unknown to the transaction.

Parameters
$oidThe object id of the object

Implemented in DefaultTransaction.

getObjects ( )

Get all objects currently involved in the transaction.

Returns
Array of PersistentObject instances

Implemented in DefaultTransaction.