Skip to content

Commit

Permalink
Transaction for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Feb 14, 2022
1 parent 77afa3d commit 3bc26d5
Showing 1 changed file with 17 additions and 1 deletion.
Expand Up @@ -51,7 +51,23 @@ public static function process($chat, $action, $trigger, $params)
if ($needUpdate == true) {
$chat->chat_variables = json_encode($chatVariables);
$chat->chat_variables_array = $chatVariables;
$chat->saveThis(array('update' => array('chat_variables')));

$db = ezcDbInstance::get();

try {

$db->beginTransaction();

// Lock record
erLhcoreClassModelChat::fetchAndLock($chat->id);

$chat->saveThis(array('update' => array('chat_variables')));

$db->commit();

} catch (Exception $e) {
$db->rollback();
}
}
}
}
Expand Down

0 comments on commit 3bc26d5

Please sign in to comment.