lightools/transaction-nesting
最新稳定版本:v1.0.1
Composer 安装命令:
composer require lightools/transaction-nesting
包简介
Allows you to nest transactions with dibi database connection.
README 文档
README
This library allows you to nest database transactions over dibi connection.
Installation
$ composer require lightools/transaction-nesting
Simple usage
TransactionManager will begin/commit/rollback database transaction only if there is no other transaction running.
So if you try to start new transaction when some transaction is active, it will not fail with error There is already an active transaction.
This means you can nest transactions safely and TransactionManager will make sure that only the outer transaction will be performed.
$dibi = new Dibi\Connection($config); $manager = new Lightools\TransactionNesting\TransactionManager($dibi); $manager->transactional(function () { // your logic });
Of course, this will break if you perform some query causing implicit commit (for example ALTER TABLE on MySQL).
How to run tests
$ vendor/bin/tester -c tests/php.ini -d extension_dir=ext tests
统计信息
- 总下载量: 14.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-22