Trac

Ticket #873: Transaction.php.patch

File Transaction.php.patch, 2.1 kB (added by zomg, 5 months ago)

Patch for Doctrine/Transaction.php

  • .

    old new  
    202202 
    203203                if ( ! $event->skipOperation) { 
    204204                    try { 
    205                         $this->conn->getDbh()->beginTransaction(); 
     205                        $this->doBeginTransaction(); 
    206206                    } catch (Exception $e) { 
    207207                        throw new Doctrine_Transaction_Exception($e->getMessage()); 
    208208                    } 
     
    217217    } 
    218218 
    219219    /** 
     220     * Actually begins the transaction. 
     221     */ 
     222    protected function doBeginTransaction() 
     223    { 
     224        $this->conn->getDbh()->beginTransaction(); 
     225    } 
     226    /** 
    220227     * commit 
    221228     * Commit the database changes done during a transaction that is in 
    222229     * progress or release a savepoint. This function may only be called when 
     
    275282 
    276283                    $listener->preTransactionCommit($event); 
    277284                    if ( ! $event->skipOperation) { 
    278                         $this->conn->getDbh()->commit(); 
     285                        $this->doCommit(); 
    279286                    } 
    280287                    $listener->postTransactionCommit($event); 
    281288                } 
     
    291298 
    292299        return true; 
    293300    } 
     301     
     302    /** 
     303     * Actually performs the commit 
     304     */ 
     305    protected function doCommit() 
     306    { 
     307        $this->conn->getDbh()->commit(); 
     308    } 
    294309 
    295310    /** 
    296311     * rollback 
     
    349364                $this->_nestingLevel = 0; 
    350365                $this->_internalNestingLevel = 0; 
    351366                try { 
    352                     $this->conn->getDbh()->rollback(); 
     367                    $this->doRollback(); 
    353368                } catch (Exception $e) { 
    354369                    throw new Doctrine_Transaction_Exception($e->getMessage()); 
    355370                } 
     
    362377    } 
    363378 
    364379    /** 
     380     * Performs the actual rollback 
     381     */ 
     382    protected function doRollback() 
     383    { 
     384        $this->conn->getDbh()->rollback(); 
     385    } 
     386     
     387    /** 
    365388     * releaseSavePoint 
    366389     * creates a new savepoint 
    367390     *