最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Drupal db_transaction 使用范式详解
时间:2022-06-24 22:44:42 编辑:袖梨 来源:一聚教程网
$transaction = isset($transaction) ? $transaction : db_transaction();
try {
$ids = array_keys($entities);
db_delete($this->entityInfo['base table'])
->condition($this->idKey, $ids, 'IN')
->execute();
if (isset($this->revisionTable)) {
db_delete($this->revisionTable)
->condition($this->idKey, $ids, 'IN')
->execute();
}
// Reset the cache as soon as the changes have been applied.
$this->resetCache($ids);
foreach ($entities as $id => $entity) {
$this->invoke('delete', $entity);
}
// Ignore slave server temporarily.
db_ignore_slave();
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
throw $e;
}
以上代码片段为使用db_transaction范式。摘抄自entity模块。
相关文章
- 无限暖暖若生命如诗新版本 2.1活动传送点和逸事攻略 07-27
- 原神月之四新版本角色攻略 哥伦比娅天赋是什么详解 07-27
- 鹅鸭杀隐藏时装怎么获得 隐藏时装与隐藏表情获得方法介绍 07-27
- 龙族卡塞尔之门康斯坦丁技能是什么 康斯坦丁技能详细介绍 07-27
- 生存33天冰魔法师怎么打 冰魔法师打法教学详解 07-27
- 明日方舟兑换码领取官网 明日方舟兑换码在哪用怎么用 07-27