\Imi\Db\TransactionTransaction

Summary

Methods
Properties
Constants
on()
one()
off()
trigger()
beginTransaction()
commit()
rollBack()
getTransactionLevels()
onTransactionCommit()
onTransactionRollback()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
rebuildEventQueue()
$events
$eventQueue
$eventChangeRecords
$transactionLevels
N/A

Properties

$events

$events : array<mixed,\Imi\Event\EventItem[]>

事件数据映射原始数据

Type

array<mixed,\Imi\Event\EventItem[]>

$eventQueue

$eventQueue : array<mixed,\SplPriorityQueue>

事件队列,按执行顺序排

Type

array<mixed,\SplPriorityQueue>

$eventChangeRecords

$eventChangeRecords : array

事件更改记录

Type

array

$transactionLevels

$transactionLevels : integer

事务层级计数

Type

integer

Methods

on()

on(string|array<mixed,string>  $name, mixed  $callback, integer  $priority) : void

事件监听

Parameters

string|array<mixed,string> $name

事件名称

mixed $callback

回调,支持回调函数、基于IEventListener的类名

integer $priority

优先级,越大越先执行

one()

one(string|array<mixed,string>  $name, mixed  $callback, integer  $priority) : void

监听事件,仅触发一次

Parameters

string|array<mixed,string> $name

事件名称

mixed $callback

回调,支持回调函数、基于IEventListener的类名

integer $priority

优先级,越大越先执行

off()

off(string|array<mixed,string>  $name, mixed|null  $callback = null) : void

取消事件监听

Parameters

string|array<mixed,string> $name

事件名称

mixed|null $callback

回调,支持回调函数、基于IEventListener的类名。为 null 则不限制

trigger()

trigger(string  $name, array  $data = array(), mixed  $target = null, string  $paramClass = \Imi\Event\EventParam::class) : void

触发事件

Parameters

string $name

事件名称

array $data

数据

mixed $target

目标对象

string $paramClass

参数类

beginTransaction()

beginTransaction() : boolean

启动一个事务

Returns

boolean

commit()

commit() : boolean

提交一个事务

Returns

boolean

rollBack()

rollBack(integer  $levels = null) : boolean

回滚事务 支持设置回滚事务层数,如果不设置则为全部回滚

Parameters

integer $levels

Returns

boolean

getTransactionLevels()

getTransactionLevels() : integer

获取事务层数

Returns

integer

onTransactionCommit()

onTransactionCommit(callable  $callable) : void

监听事务提交事件

Parameters

callable $callable

onTransactionRollback()

onTransactionRollback(callable  $callable) : void

监听事务回滚事件

Parameters

callable $callable

rebuildEventQueue()

rebuildEventQueue(  $name) : void

重建事件队列

Parameters

$name