Conditions | 3 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
41 | protected function deleteConnection(IntegrationConnection $connection): bool |
||
42 | { |
||
43 | // Db transaction |
||
44 | $transaction = Craft::$app->getDb()->beginTransaction(); |
||
45 | |||
46 | try { |
||
47 | if (!$connection->getConfiguration()->delete()) { |
||
48 | $connection->addError('configuration', 'Unable to delete configuration.'); |
||
49 | $transaction->rollBack(); |
||
50 | return false; |
||
51 | } |
||
52 | } catch (\Exception $e) { |
||
53 | $transaction->rollBack(); |
||
54 | throw $e; |
||
55 | } |
||
56 | |||
57 | $transaction->commit(); |
||
58 | return true; |
||
59 | } |
||
60 | } |
||
61 |