src/db/orm/DAO.php
public function transaction(\Closure $task) {
        try {
            $this->db()->begin();
            $result = $task();
            $this->db()->commit();
            return $result;
        }
        catch (\Exception $ex) {
            $this->db()->rollback();
            throw $ex;
        }
    }
public function transaction(\Closure $task) {
        try {
            $this->db()->begin();
            $result = $task();
            $this->db()->commit();
            return $result;
        }
        catch (\Exception $ex) {
            $this->db()->rollback();
            throw $ex;
        }
    }
public function transaction ( \ Closure $ task ) { try { $ this -> db ( ) -> begin ( ) ; $ result = $ task ( ) ; $ this -> db ( ) -> commit ( ) ; return $ result ; } catch ( \ Exception $ ex ) { $ this -> db ( ) -> rollback ( ) ; throw $ ex ; } }
Execute a task in a transactional way. The transaction is automatically committed or rolled back.
A nested transaction is executed in the context of the nesting transaction.

@param  \Closure $task - task to execute (an anonymous function is implicitly casted)

@return mixed - the task's return value (if any)
Execute a task in a transactional way . The transaction is automatically committed or rolled back . A nested transaction is executed in the context of the nesting transaction .