Test Failed
Pull Request — dev (#85)
by Def
02:43
created

TransactionPDOMssql::setIsolationLevel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
ccs 0
cts 6
cp 0
crap 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Mssql\PDO;
6
7
use Throwable;
8
use Yiisoft\Db\Exception\Exception;
9
use Yiisoft\Db\Exception\InvalidConfigException;
10
use Yiisoft\Db\Exception\NotSupportedException;
11
use Yiisoft\Db\Transaction\TransactionPDO;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Transaction\TransactionPDO was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
final class TransactionPDOMssql extends TransactionPDO
14
{
15
    /**
16
     * Creates a new savepoint.
17
     *
18
     * @param string $name the savepoint name.
19
     *
20
     * @throws Exception|InvalidConfigException|Throwable
21
     */
22
    public function createSavepoint(string $name): void
23
    {
24
        $this->db->createCommand("SAVE TRANSACTION $name")->execute();
25
    }
26
27
    /**
28
     * Releases an existing savepoint.
29
     *
30
     * @param string $name the savepoint name.
31
     *
32
     * @throws NotSupportedException
33
     */
34
    public function releaseSavepoint(string $name): void
35
    {
36
        // does nothing as MSSQL does not support this
37
    }
38
39
    /**
40
     * Rolls back to a previously created savepoint.
41
     *
42
     * @param string $name the savepoint name.
43
     *
44
     * @throws Exception|InvalidConfigException|Throwable
45
     */
46
    public function rollBackSavepoint(string $name): void
47
    {
48
        $this->db->createCommand("ROLLBACK TRANSACTION $name")->execute();
49
    }
50
}
51