2021-08-24 20:48:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\Helper;
|
|
|
|
|
|
|
|
use OC;
|
|
|
|
use OCP\IDBConnection;
|
|
|
|
|
|
|
|
trait DatabaseTransaction {
|
|
|
|
|
|
|
|
public function startTransaction() {
|
|
|
|
/* @var $db IDBConnection */
|
|
|
|
$db = OC::$server->get(IDBConnection::class);
|
|
|
|
|
|
|
|
$db->beginTransaction();
|
|
|
|
}
|
|
|
|
|
2021-10-18 08:36:22 +00:00
|
|
|
public function rollbackTransaction() {
|
2021-08-24 20:48:46 +00:00
|
|
|
/* @var $db IDBConnection */
|
|
|
|
$db = OC::$server->get(IDBConnection::class);
|
|
|
|
|
|
|
|
$db->rollBack();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|