TestTransationService.php 551 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Siam
  5. * Date: 2020/6/8
  6. * Time: 10:18
  7. */
  8. namespace EasySwoole\ORM\Tests\service;
  9. use EasySwoole\ORM\DbManager;
  10. class TestTransationService
  11. {
  12. public static $res = true;
  13. public static function getUser()
  14. {
  15. DbManager::getInstance()->startTransactionWithCount();
  16. $res = static::$res;
  17. if ($res){
  18. DbManager::getInstance()->commitWithCount();
  19. return true;
  20. }
  21. DbManager::getInstance()->rollbackWithCount();
  22. return false;
  23. }
  24. }