1 | <?php declare(strict_types=1); |
||
46 | abstract class BaseMigrationRunner |
||
47 | { |
||
48 | /** Migrations table name */ |
||
49 | const MIGRATIONS_TABLE = '_migrations'; |
||
50 | |||
51 | /** Migration column name */ |
||
52 | const MIGRATIONS_COLUMN_ID = 'id'; |
||
53 | |||
54 | /** Migration column name */ |
||
55 | const MIGRATIONS_COLUMN_CLASS = 'class'; |
||
56 | |||
57 | /** Migration column name */ |
||
58 | const MIGRATIONS_COLUMN_MIGRATED_AT = 'migrated_at'; |
||
59 | |||
60 | /** Seeds table name */ |
||
61 | const SEEDS_TABLE = '_seeds'; |
||
62 | |||
63 | /** |
||
64 | * @var IoInterface |
||
65 | */ |
||
66 | private $inOut; |
||
67 | |||
68 | /** |
||
69 | * @return string[] |
||
70 | 2 | */ |
|
71 | abstract protected function getMigrationClasses(): array; |
||
72 | 2 | ||
73 | /** |
||
74 | * @param IoInterface $inOut |
||
75 | */ |
||
76 | public function __construct(IoInterface $inOut) |
||
80 | |||
81 | /** |
||
82 | * @param ContainerInterface $container |
||
83 | * |
||
84 | 1 | * @return void |
|
85 | * |
||
86 | 1 | * @throws ContainerExceptionInterface |
|
87 | 1 | * @throws NotFoundExceptionInterface |
|
88 | 1 | * @throws DBALException |
|
89 | 1 | * |
|
90 | 1 | * @SuppressWarnings(PHPMD.IfStatementAssignment) |
|
91 | 1 | */ |
|
92 | public function migrate(ContainerInterface $container): void |
||
103 | |||
104 | /** |
||
105 | * @param ContainerInterface $container |
||
106 | 1 | * |
|
107 | * @return void |
||
108 | 1 | * |
|
109 | 1 | * @throws ContainerExceptionInterface |
|
110 | 1 | * @throws InvalidArgumentException |
|
111 | 1 | * @throws NotFoundExceptionInterface |
|
112 | 1 | * @throws DBALException |
|
113 | 1 | * |
|
114 | * @SuppressWarnings(PHPMD.IfStatementAssignment) |
||
115 | */ |
||
116 | public function rollback(ContainerInterface $container): void |
||
135 | |||
136 | /** |
||
137 | * @return IoInterface |
||
138 | */ |
||
139 | 3 | protected function getIO(): IoInterface |
|
143 | 3 | ||
144 | /** |
||
145 | * @param IoInterface $inOut |
||
146 | * |
||
147 | * @return self |
||
148 | */ |
||
149 | private function setIO(IoInterface $inOut): self |
||
155 | |||
156 | /** |
||
157 | 1 | * @param ContainerInterface $container |
|
158 | * |
||
159 | 1 | * @return Generator |
|
160 | 1 | * |
|
161 | * @throws ContainerExceptionInterface |
||
162 | 1 | * @throws NotFoundExceptionInterface |
|
163 | 1 | * |
|
164 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
165 | 1 | * @throws DBALException |
|
166 | 1 | */ |
|
167 | private function getMigrations(ContainerInterface $container): Generator |
||
186 | |||
187 | 1 | /** |
|
188 | * @param ContainerInterface $container |
||
189 | 1 | * |
|
190 | 1 | * @return Generator |
|
191 | * |
||
192 | 1 | * @throws ContainerExceptionInterface |
|
193 | 1 | * @throws NotFoundExceptionInterface |
|
194 | 1 | * @throws InvalidArgumentException |
|
195 | * @throws DBALException |
||
196 | */ |
||
197 | private function getRollbacks(ContainerInterface $container): Generator |
||
207 | |||
208 | 1 | /** |
|
209 | * @param ContainerInterface $container |
||
210 | * |
||
211 | * @return Connection |
||
212 | * |
||
213 | * @throws ContainerExceptionInterface |
||
214 | * @throws NotFoundExceptionInterface |
||
215 | */ |
||
216 | private function getConnection(ContainerInterface $container): Connection |
||
220 | 1 | ||
221 | /** |
||
222 | * @param AbstractSchemaManager $manager |
||
223 | 1 | * |
|
224 | 1 | * @return void |
|
225 | 1 | * |
|
226 | * @throws DBALException |
||
227 | 1 | */ |
|
228 | 1 | private function createMigrationsTable(AbstractSchemaManager $manager): void |
|
247 | |||
248 | 1 | /** |
|
249 | * @param Connection $connection |
||
250 | 1 | * |
|
251 | 1 | * @return array |
|
252 | 1 | */ |
|
253 | 1 | private function readMigrated(Connection $connection): array |
|
274 | 1 | ||
275 | /** |
||
276 | 1 | * @param Connection $connection |
|
277 | 1 | * @param string $class |
|
278 | 1 | * |
|
279 | 1 | * @return void |
|
280 | 1 | * |
|
281 | * @throws DBALException |
||
282 | * @throws Exception |
||
283 | */ |
||
284 | private function saveMigration(Connection $connection, string $class): void |
||
293 | |||
294 | 1 | /** |
|
295 | * @param Connection $connection |
||
296 | 1 | * @param int $index |
|
297 | * |
||
298 | * @return void |
||
299 | * |
||
300 | * @throws InvalidArgumentException |
||
301 | * |
||
302 | * @throws DBALException |
||
303 | */ |
||
304 | private function removeMigration(Connection $connection, int $index): void |
||
308 | |||
309 | /** |
||
310 | * @param string $class |
||
311 | 2 | * @param ContainerInterface $container |
|
312 | 1 | * |
|
313 | 1 | * @return MigrationInterface|null |
|
314 | */ |
||
315 | private function createMigration(string $class, ContainerInterface $container): ?MigrationInterface |
||
328 | } |
||
329 |
This class constant has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.