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

 begin ()
 
 commit ()
 
 rollback ()
 
 isActive ()
 
 attach (PersistentObject $object)
 
 detach (ObjectId $oid)
 
 getLoaded (ObjectId $oid)
 
 getObjects ()
 

Member Function Documentation

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.

attach ( PersistentObject  $object)

Attach an object to the transaction.

The returned object is the attached instance.

Parameters
$objectThe object
Returns
PersistentObject

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.

getLoaded ( ObjectId  $oid)

Get a loaded object.

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

Implemented in DefaultTransaction.

getObjects ( )

Get all objects currently involved in the transaction.

Returns
Array of PersistentObject instances

Implemented in DefaultTransaction.