2017 © Pedro Peláez
 

library stefano-nested-transaction

Nested Transaction Manager

image

stefano/stefano-nested-transaction

Nested Transaction Manager

  • Wednesday, February 28, 2018
  • by Stefano123
  • Repository
  • 1 Watchers
  • 2 Stars
  • 4,133 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 14 % Grown

The README.md

Stefano Nested Transaction

Build Status Coverage Status, (*1)

Instalation using Composer

  1. Run command composer require stefano/stefano-nested-transaction

Features

  • manages nested transaction

Usage

  • Configuration
//$transactionAdapter implements \StefanoNestedTransaction\Adapter\TransactionInterface
$transactionAdapter = new YourTransactionAdapter();

$transactionManager = new \StefanoNestedTransaction\TransactionManager($transactionAdapter);
  • Example: normal flow
$transactionManager->begin(); //REAL start transaction
try {
    // ...

    //nested transaction block, that might be in some other code
    $transactionManager->begin(); //increase internal transaction counter
    try {
        // ...

        $transactionManager->commit(); //decrease internal transaction counter
    } catch(\Exception $e) {
        $transactionManager->rollback(); //skipped
        throw $e->getPrevious();
    }

    // ...
    $transactionManager->commit(); //REAL commit transaction;
} catch(\Exception $e) {
    $transactionManager->rollback(); //skipped
    throw $e->getPrevious();
}
  • Example: throw exception
$transactionManager->begin(); //REAL start transaction
try {
    // ...

    //nested transaction block, that might be in some other code
    $transactionManager->begin(); //increase internal transaction counter
    try {
        // ...

        throw new \Exception();

        $transactionManager->commit(); //skipped
    } catch(\Exception $e) {
        $transactionManager->rollback(); //marked as rollback only
        throw $e->getPrevious();
    }

    // ...
    $transactionManager->commit(); //skipped
} catch(\Exception $e) {
    $transactionManager->rollback(); //REAL rollback
    throw $e->getPrevious();
}
  • Example: throw exception
$transactionManager->begin(); //REAL start transaction
try {
    // ...

    //nested transaction block, that might be in some other code
    $transactionManager->begin(); //increase internal transaction counter
    try {
        // ...

        throw new \Exception();

        $transactionManager->commit(); //do nothing
    } catch(\Exception $e) {
        $transactionManager->rollback(); //marked as rollback only
    }

    // ...
    $transactionManager->commit(); //this throw exception because transaction is marked as rollback only
} catch(\Exception $e) {
    $transactionManager->rollback(); //REAL rollback
    throw $e->getPrevious();
}

The Versions

28/02 2018

dev-master

9999999-dev https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.0.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

21/09 2017

0.1.0

0.1.0.0 https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.0.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

31/03 2017

0.0.4

0.0.4.0 https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

23/01 2014

dev-develop

dev-develop https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

23/01 2014

0.0.3

0.0.3.0 https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

23/01 2014

0.0.2

0.0.2.0 https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction

21/01 2014

0.0.1

0.0.1.0 https://github.com/bartko-s/stefano-nested-transaction

Nested Transaction Manager

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Štefan Bartko

db transaction nested transaction