Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Throwable;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Arrays\ArraySorter;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Constraint\CheckConstraint;
use Yiisoft\Db\Constraint\Constraint;
use Yiisoft\Db\Constraint\ConstraintFinderInterface;
Expand All @@ -23,6 +22,7 @@
use Yiisoft\Db\Schema\Schema as AbstractSchema;
use Yiisoft\Db\Transaction\Transaction;

use Yiisoft\Db\Transaction\TransactionInterface;
use function count;
use function explode;
use function get_class;
Expand All @@ -37,7 +37,7 @@
* Schema is the class for retrieving metadata from a SQLite (2/3) database.
*
* @property string $transactionIsolationLevel The transaction isolation level to use for this transaction. This can be
* either {@see Transaction::READ_UNCOMMITTED} or {@see Transaction::SERIALIZABLE}.
* either {@see TransactionInterface::READ_UNCOMMITTED} or {@see TransactionInterface::SERIALIZABLE}.
*/
final class Schema extends AbstractSchema implements ConstraintFinderInterface
{
Expand Down Expand Up @@ -472,7 +472,7 @@ protected function loadColumnSchema(array $info): ColumnSchema
* Sets the isolation level of the current transaction.
*
* @param string $level The transaction isolation level to use for this transaction. This can be either
* {@see Transaction::READ_UNCOMMITTED} or {@see Transaction::SERIALIZABLE}.
* {@see TransactionInterface::READ_UNCOMMITTED} or {@see TransactionInterface::SERIALIZABLE}.
*
* @throws Exception|InvalidConfigException|Throwable|NotSupportedException when unsupported isolation levels are
* used. SQLite only supports SERIALIZABLE and READ UNCOMMITTED.
Expand All @@ -482,10 +482,10 @@ protected function loadColumnSchema(array $info): ColumnSchema
public function setTransactionIsolationLevel(string $level): void
{
switch ($level) {
case Transaction::SERIALIZABLE:
case TransactionInterface::SERIALIZABLE:
$this->getDb()->createCommand('PRAGMA read_uncommitted = False;')->execute();
break;
case Transaction::READ_UNCOMMITTED:
case TransactionInterface::READ_UNCOMMITTED:
$this->getDb()->createCommand('PRAGMA read_uncommitted = True;')->execute();
break;
default:
Expand Down
5 changes: 3 additions & 2 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Yiisoft\Db\Sqlite\Connection;
use Yiisoft\Db\Transaction\Transaction;
use Yiisoft\Db\TestUtility\TestConnectionTrait;
use Yiisoft\Db\Transaction\TransactionInterface;

/**
* @group sqlite
Expand Down Expand Up @@ -436,11 +437,11 @@ public function testTransactionIsolation(): void
{
$connection = $this->getConnection(true);

$transaction = $connection->beginTransaction(Transaction::READ_UNCOMMITTED);
$transaction = $connection->beginTransaction(TransactionInterface::READ_UNCOMMITTED);

$transaction->rollBack();

$transaction = $connection->beginTransaction(Transaction::SERIALIZABLE);
$transaction = $connection->beginTransaction(TransactionInterface::SERIALIZABLE);

$transaction->rollBack();

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Factory\DatabaseFactory;
use Yiisoft\Db\Helper\Dsn;
use Yiisoft\Db\Connection\Dsn;
use Yiisoft\Db\Sqlite\Connection;
use Yiisoft\Db\TestUtility\IsOneOfAssert;
use Yiisoft\Di\Container;
Expand Down