1 | <?php |
||
22 | class SynchronizationPool extends Component |
||
23 | { |
||
24 | use LoggerTrait; |
||
25 | |||
26 | /** |
||
27 | * @var AbstractTable[] |
||
28 | */ |
||
29 | private $tables = []; |
||
30 | |||
31 | /** |
||
32 | * @var Driver[] |
||
33 | */ |
||
34 | private $drivers = []; |
||
35 | |||
36 | /** |
||
37 | * @param AbstractTable[] $tables |
||
38 | */ |
||
39 | public function __construct(array $tables) |
||
45 | |||
46 | /** |
||
47 | * @return AbstractTable[] |
||
48 | */ |
||
49 | public function getTables() |
||
53 | |||
54 | /** |
||
55 | * List of tables sorted in order of cross dependency. |
||
56 | * |
||
57 | * @return AbstractTable[] |
||
58 | */ |
||
59 | public function sortedTables(): array |
||
71 | |||
72 | /** |
||
73 | * Synchronize tables. |
||
74 | * |
||
75 | * @param LoggerInterface|null $logger |
||
76 | * |
||
77 | * @throws \Exception |
||
78 | * @throws \Throwable |
||
79 | */ |
||
80 | public function run(LoggerInterface $logger = null) |
||
118 | |||
119 | /** |
||
120 | * Begin mass transaction. |
||
121 | */ |
||
122 | protected function beginTransaction() |
||
130 | |||
131 | /** |
||
132 | * Commit mass transaction. |
||
133 | */ |
||
134 | protected function commitTransaction() |
||
142 | |||
143 | /** |
||
144 | * Roll back mass transaction. |
||
145 | */ |
||
146 | protected function rollbackTransaction() |
||
154 | |||
155 | /** |
||
156 | * Collecting all involved drivers. |
||
157 | */ |
||
158 | private function collectDrivers() |
||
166 | } |
||
167 |