Zend 2 db transactions?

前端 未结 2 872
遇见更好的自我
遇见更好的自我 2021-02-09 09:01

How do we use transactions in Zend 2? I didn\'t find anything in the API, and a couple questions for Zend 1 refered to the regular PDO functions, but I don\'t see anything like

2条回答
  •  梦如初夏
    2021-02-09 09:21

    The documentation is lacking a bit in this department for ZF2:

    Start Transaction:

    $this->adapter->getDriver()->getConnection()->beginTransaction();
    

    Commit Transaction:

    $this->adapter->getDriver()->getConnection()->commit();
    

    Rollback Transaction:

    $this->adapter->getDriver()->getConnection()->rollback();
    

提交回复
热议问题