Total Complexity | 6 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class DoctrineDBALCleaner implements CleanerInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var Connection |
||
17 | */ |
||
18 | private $connection; |
||
19 | |||
20 | /** |
||
21 | * @var DBCleanerConfig |
||
22 | */ |
||
23 | private $config; |
||
24 | |||
25 | 5 | public function __construct(Connection $connection, DBCleanerConfig $config) |
|
29 | 5 | } |
|
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 5 | public function clear(): void |
|
35 | { |
||
36 | 5 | if ($this->config->isTransactional()) { |
|
37 | $this->connection->transactional(function () { |
||
38 | 2 | $this->executeQueries(); |
|
39 | 2 | }); |
|
40 | } else { |
||
41 | 3 | $this->executeQueries(); |
|
42 | } |
||
43 | 3 | } |
|
44 | |||
45 | /** |
||
46 | * @throws CleanerException |
||
47 | */ |
||
48 | 5 | private function executeQueries(): void |
|
59 | } |
||
60 | } |
||
63 |