Manager
extends AbstractManager
in package
Nested transaction manager for use in AdapaterInterface implementations
Tags
Table of Contents
Constants
- TS_NONE = 0
- TS_OPEN = 1
- TS_ROLLED_BACK = -1
Properties
- $savepointName : int
- $savepoints : array<string|int, string>
- Names of active savepoints. Count is always one less than $transactionDepth.
- $transactionDepth : int
- Transaction depth
- $transactionState : int
- Transaction state flag
- $useSavepoints : bool
- Use savepoints or simulated nested transactions (SNTs)
Methods
- __construct() : mixed
- Constructor
- enter() : bool
- Enter a new transaction or increase nesting level
- getTransactionDepth() : int
- Get transaction depth
- isTransaction() : bool
- Check if adapter is in the middle of an open transaction
- leave() : bool
- Leave a transaction or reduce nesting level
Constants
TS_NONE
private
mixed
TS_NONE
= 0
TS_OPEN
private
mixed
TS_OPEN
= 1
TS_ROLLED_BACK
private
mixed
TS_ROLLED_BACK
= -1
Properties
$savepointName
private
int
$savepointName
= 0
$savepoints
Names of active savepoints. Count is always one less than $transactionDepth.
private
array<string|int, string>
$savepoints
= []
$transactionDepth
Transaction depth
private
int
$transactionDepth
= 0
$transactionState
Transaction state flag
private
int
$transactionState
= 0
$useSavepoints
Use savepoints or simulated nested transactions (SNTs)
private
bool
$useSavepoints
Methods
__construct()
Constructor
public
__construct([bool $useSavepoints = true ]) : mixed
Instantiate the transaction manager object
Parameters
- $useSavepoints : bool = true
-
Enable the use of savepoints by default
enter()
Enter a new transaction or increase nesting level
public
enter([callable|null $beginFunc = null ][, callable|null $savepointFunc = null ]) : bool
Parameters
- $beginFunc : callable|null = null
-
Called when a new top-level transaction must be started
- $savepointFunc : callable|null = null
-
Called when a named savepoint is created
Return values
boolgetTransactionDepth()
Get transaction depth
public
getTransactionDepth() : int
Return values
intisTransaction()
Check if adapter is in the middle of an open transaction
public
isTransaction() : bool
Return values
boolleave()
Leave a transaction or reduce nesting level
public
leave(bool $doCommit[, callable|null $commitFunc = null ][, callable|null $rollbackFunc = null ][, callable|null $savepointReleaseFunc = null ][, callable|null $savepointRollbackFunc = null ]) : bool
Parameters
- $doCommit : bool
-
If true, perform a commit. Rollback otherwise.
- $commitFunc : callable|null = null
-
Called when a top-level commit must be performed
- $rollbackFunc : callable|null = null
-
Called when a top-level rollback must be performed
- $savepointReleaseFunc : callable|null = null
-
Called when a savepoint is released (like commit)
- $savepointRollbackFunc : callable|null = null
-
Called when the transaction is rolled back to a savepoint