cakephp数据库事务transactions

原理:获取数据库资源句柄 -》curd 操作-》使用 rallback或者submit 提交或者回滚即可

例子:

$dataSource = $this->getDataSource();
$dataSource->begin();

// Perform some tasks

if (/*all's well*/) {
    $dataSource->commit();
} else {
    $dataSource->rollback();
}
原文地址:https://www.cnblogs.com/linksgo2011/p/3049354.html