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.
Definition at line 21 of file Transaction.php.
Public Member Functions | |
begin () | |
commit () | |
commitCollect () | |
rollback () | |
isActive () | |
attach (PersistentObject $object) | |
detach (ObjectId $oid) | |
getLoaded (ObjectId $oid) | |
getObjects () | |
Member Function Documentation
◆ begin()
begin | ( | ) |
Set the transaction active (object changes will be recorded).
Implemented in DefaultTransaction.
◆ commit()
commit | ( | ) |
Commit the object changes to the storage.
Sets the transaction to inactive.
- Returns
- Array of executed statements (see PersistenceMapper::getStatements())
Implemented in DefaultTransaction.
◆ commitCollect()
commitCollect | ( | ) |
Collect object change statements.
Acts like a normal commit, but does not execute the statements. Sets the transaction to inactive.
- Returns
- Array of statements to be executed (see PersistenceMapper::getStatements())
Implemented in DefaultTransaction.
◆ rollback()
rollback | ( | ) |
◆ isActive()
isActive | ( | ) |
◆ attach()
attach | ( | PersistentObject | $object | ) |
Attach an object to the transaction.
The returned object is the attached instance.
- Parameters
-
$object The object
- Returns
- PersistentObject
Implemented in DefaultTransaction.
◆ detach()
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
-
$oid The object id of the object
Implemented in DefaultTransaction.
◆ getLoaded()
getLoaded | ( | ObjectId | $oid | ) |
Get a loaded object.
- Parameters
-
$oid ObjectId of the object
- Returns
- PersistentObject instance or null if not loaded yet
Implemented in DefaultTransaction.
◆ getObjects()
getObjects | ( | ) |
Get all objects currently involved in the transaction.
- Returns
- Array of PersistentObject instances
Implemented in DefaultTransaction.