DefaultTransactionFactory extends TransactionFactory
A default transaction factory implementation.
This ONLY works for MySQL as that is currently the only storage engine I've provided code for.
Table of Contents
$map | A map of interface => function(IRunnable ...$tasks) for creating instances of some transaction type. | array |
---|---|---|
$keys | A list of map keys | string |
__construct() | Create a new TransactionFactory instance | mixed |
__construct() | Create a new TransactionFactory instance | mixed |
createTransactions() | Create a list of transactions for some list of runnables | \buffalokiwi\magicgraph\persist\ITransaction[] |
execute() | Execute a bunch of transactions directly. | void |
executeAndTry() | Executes all transactions, then attempts to execute the code in $afterExecute. | void |
Properties
$map
A map of interface => function(IRunnable ...$tasks) for creating instances of some transaction type.
private
array
$map
$keys
A list of map keys
private
string
$keys
= []
Methods
__construct()
Create a new TransactionFactory instance
public
__construct(
)
: mixed
Return values
mixed__construct()
Create a new TransactionFactory instance
public
__construct(
$map :
array
)
: mixed
Parameters
- $map : array
A map of interface => function(IRunnable ...$tasks) for creating instances of some transaction type.
Return values
mixedcreateTransactions()
Create a list of transactions for some list of runnables
public
createTransactions(
...$tasks :
IRunnable
)
: \buffalokiwi\magicgraph\persist\ITransaction[]
Parameters
- $tasks : IRunnable
tasks
Tags
Return values
\buffalokiwi\magicgraph\persist\ITransaction[] —transactions
execute()
Execute a bunch of transactions directly.
public
execute(
...$tasks :
IRunnable
)
: void
This wraps then with something like the ChainedTransactionManager and calls run().
Parameters
- $tasks : IRunnable
Tasks to run
executeAndTry()
Executes all transactions, then attempts to execute the code in $afterExecute.
public
executeAndTry(
$afterExecute :
Closure
, ...$tasks :
IRunnable
)
: void
If afterExecute throws an exception, then all transactions are rolled back.
Parameters
- $afterExecute : Closure
f() : void throws \Exception - Do this after execute, and before commit.
- $tasks : IRunnable
Tasks to execute