1 | <?php |
||
23 | class SynchronizationPool extends Component |
||
24 | { |
||
25 | /** |
||
26 | * @var AbstractTable[] |
||
27 | */ |
||
28 | private $tables = []; |
||
29 | |||
30 | /** |
||
31 | * @var Driver[] |
||
32 | */ |
||
33 | private $drivers = []; |
||
34 | |||
35 | /** |
||
36 | * @param AbstractTable[] $tables |
||
37 | */ |
||
38 | public function __construct(array $tables) |
||
44 | |||
45 | /** |
||
46 | * @return AbstractTable[] |
||
47 | */ |
||
48 | public function getTables() |
||
52 | |||
53 | /** |
||
54 | * List of tables sorted in order of cross dependency. |
||
55 | * |
||
56 | * @return AbstractTable[] |
||
57 | */ |
||
58 | public function sortedTables(): array |
||
70 | |||
71 | /** |
||
72 | * Synchronize tables. |
||
73 | * |
||
74 | * @param LoggerInterface|null $logger |
||
75 | * |
||
76 | * @throws \Exception |
||
77 | * @throws \Throwable |
||
78 | */ |
||
79 | public function run(LoggerInterface $logger = null) |
||
116 | |||
117 | /** |
||
118 | * Begin mass transaction. |
||
119 | */ |
||
120 | protected function beginTransaction() |
||
126 | |||
127 | /** |
||
128 | * Commit mass transaction. |
||
129 | */ |
||
130 | protected function commitTransaction() |
||
139 | |||
140 | /** |
||
141 | * Roll back mass transaction. |
||
142 | */ |
||
143 | protected function rollbackTransaction() |
||
152 | |||
153 | /** |
||
154 | * @param LoggerInterface|null $logger |
||
155 | */ |
||
156 | protected function dropForeigns(LoggerInterface $logger = null) |
||
164 | |||
165 | /** |
||
166 | * @param LoggerInterface|null $logger |
||
167 | */ |
||
168 | protected function dropIndexes(LoggerInterface $logger = null) |
||
176 | |||
177 | /** |
||
178 | * @param LoggerInterface|null $logger |
||
179 | * |
||
180 | * @return AbstractTable[] Created or updated tables. |
||
181 | */ |
||
182 | protected function runChanges(LoggerInterface $logger = null): array |
||
199 | |||
200 | /** |
||
201 | * Collecting all involved drivers. |
||
202 | */ |
||
203 | private function collectDrivers() |
||
211 | } |
||
212 |