2017 © Pedro Peláez
 

library dibi-transactions

Nested transactions for Dibi.

image

inlm/dibi-transactions

Nested transactions for Dibi.

  • Sunday, June 24, 2018
  • by janpecha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 20 % Grown

The README.md

Inlm\DibiTransactions

Build Status Downloads this Month Latest Stable Version License, (*1)

Nested transactions for Dibi., (*2)

Donate, (*3)

Installation

Download a latest package or use Composer:, (*4)

composer require inlm/dibi-transactions

Inlm\Dibi-transactions requires PHP 8.0 or later and Dibi., (*5)

Usage

``` php $connection = new Dibi\Connection(); $transactions = new Inlm\DibiTransactions\Transactions($connection);, (*6)


### `transactional()` ``` php $value = $transactions->transactional(function () use ($connection) { $connection->query('...'); $connection->query('...'); return $value; });

Transaction

``` php $transaction = $transactions->createTransaction();, (*7)

try { $connection->query('...'); $connection->query('...'); $transaction->commit();, (*8)

} catch (Exception $e) { $transaction->rollback(); throw $e; }, (*9)


Object `Transaction` throws error if you forget to call `commit()` or `rollback()`. It can be connected with [Tracy](https://tracy.nette.org/): ``` php $transactions->onUnresolved[] = array(Inlm\DibiTransactions\Bridges\Tracy::class, 'logUnresolved');

begin / commit / rollback

``` php try { $transactions->begin(); $connection->query('...'); $connection->query('...'); $transactions->commit();, (*10)

} catch (Exception $e) { $transactions->rollback(); } ```, (*11)


License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/, (*12)

The Versions

24/06 2018

dev-master

9999999-dev

Nested transactions for Dibi.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

18/09 2017

v0.7.0

0.7.0.0

Nested transactions for Dibi.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires