public function atomicMethod(...$args)
    {
        $di = $this->getDI();
        $router = $di->get('router');
        $matchedRoute = $router->getMatchedRoute();
        $handler = $matchedRoute->getName();
        $db = $di->get('db');
        $store = $this->getDI()->get('store');
        $db->begin();
        $store->update('transaction_is_atomic', true);

        try {
            $result = $this->{$handler}(...$args);
            $store->update('rollback_transaction', false);
            return $result;
        } catch (\Throwable $e) {
            $store->update('rollback_transaction', true);
            throw $e;
        }
    }
public function atomicMethod(...$args)
    {
        $di = $this->getDI();
        $router = $di->get('router');
        $matchedRoute = $router->getMatchedRoute();
        $handler = $matchedRoute->getName();
        $db = $di->get('db');
        $store = $this->getDI()->get('store');
        $db->begin();
        $store->update('transaction_is_atomic', true);

        try {
            $result = $this->{$handler}(...$args);
            $store->update('rollback_transaction', false);
            return $result;
        } catch (\Throwable $e) {
            $store->update('rollback_transaction', true);
            throw $e;
        }
    }
public function atomicMethod ( ... $ args ) { $ di = $ this -> getDI ( ) ; $ router = $ di -> get ( 'router' ) ; $ matchedRoute = $ router -> getMatchedRoute ( ) ; $ handler = $ matchedRoute -> getName ( ) ; $ db = $ di -> get ( 'db' ) ; $ store = $ this -> getDI ( ) -> get ( 'store' ) ; $ db -> begin ( ) ; $ store -> update ( 'transaction_is_atomic' , true ) ; try { $ result = $ this -> { $ handler } ( ... $ args ) ; $ store -> update ( 'rollback_transaction' , false ) ; return $ result ; } catch ( \ Throwable $ e ) { $ store -> update ( 'rollback_transaction' , true ) ; throw $ e ; } }
proxy through which all atomic requests are passed.

set flags to know that the system is dealing with an atomic request
a transaction is started
we decide what to do with the transaction:
- commit (all operations were successful)
- rollback (a problem occurred)

@param mixed ...$args
@return mixed
@throws \Throwable
proxy through which all atomic requests are passed .