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.
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
-
$object PersistentObject instance
- Returns
- PersistentObject instance
Implemented in DefaultTransaction.
| registerNew | ( | PersistentObject | $object | ) |
Register a newly created object.
- Parameters
-
$object PersistentObject instance
Implemented in DefaultTransaction.
| registerDirty | ( | PersistentObject | $object | ) |
Register a dirty object.
- Parameters
-
$object PersistentObject instance
Implemented in DefaultTransaction.
| registerDeleted | ( | PersistentObject | $object | ) |
Register a deleted object.
- Parameters
-
$object PersistentObject 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 | ( | ) |
| isActive | ( | ) |
| 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.
| 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.
| getObjects | ( | ) |
Get all objects currently involved in the transaction.
- Returns
- Array of PersistentObject instances
Implemented in DefaultTransaction.