Giter VIP home page Giter VIP logo

transaction-nesting's Introduction

Introduction

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

transaction-nesting's People

Contributors

janedbal avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

transaction-nesting's Issues

Dibi 3.* and collision of dg/dibi and dibi/dibi

Hi Jan,

I found yours package and I really like it. Very good work I think. ๐Ÿ‘ It completely solved a problem in my app. But I have two problems with this package:

  1. It uses Dibi 2.* (which is without namespaces), but there is Dibi 3. with namespaces.
  2. In composer.json is dependency on dibi/dibi, but other packages like Tharos/LeanMapper are dependent on dg/dibi. These are completely same libraries but in different composer packages. Solution for this can be a move of dibi/dibi from require section to suggest section in composer.json. What do you think about it?

Can I create a pull request with these changes or can you change these simple things at your own?

I look forward to hearing from you.
Jan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.