Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. public function execute(callable $function)
  2. {
  3. $transaction = \Yii::$app->db->beginTransaction();
  4. try {
  5. call_user_func($function);
  6. $transaction->commit();
  7. } catch (\Exception $e) {
  8. $transaction->rollBack();
  9. throw $e;
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement