Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 94.12% |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | final class Transaction implements TransactionInterface |
||
|
|||
20 | { |
||
21 | private ?UnitOfWork $uow = null; |
||
22 | |||
23 | 2828 | public function __construct( |
|
27 | } |
||
28 | |||
29 | 2724 | public function persist(object $entity, int $mode = self::MODE_CASCADE): self |
|
30 | { |
||
31 | 2724 | $this->initUow()->persistDeferred($entity, $mode === self::MODE_CASCADE); |
|
32 | |||
33 | 2724 | return $this; |
|
34 | } |
||
35 | |||
36 | 168 | public function delete(object $entity, int $mode = self::MODE_CASCADE): self |
|
37 | { |
||
38 | 168 | $this->initUow()->delete($entity, $mode === self::MODE_CASCADE); |
|
39 | |||
40 | 168 | return $this; |
|
41 | } |
||
42 | |||
43 | 2828 | public function run(): void |
|
44 | { |
||
45 | 2828 | if ($this->uow === null) { |
|
46 | return; |
||
47 | } |
||
48 | 2828 | $uow = $this->uow->run(); |
|
49 | 2828 | $this->uow = null; |
|
50 | |||
51 | 2828 | if (!$uow->isSuccess()) { |
|
52 | 120 | throw $uow->getLastError(); |
|
53 | } |
||
54 | } |
||
55 | |||
56 | 2828 | private function initUow(): UnitOfWork |
|
60 | } |
||
61 | } |
||
62 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.