-
Notifications
You must be signed in to change notification settings - Fork 0
/
MigrationInterface.php
40 lines (32 loc) · 986 Bytes
/
MigrationInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Draw\Component\EntityMigrator;
/**
* @template T of MigrationTargetEntityInterface
*/
interface MigrationInterface
{
public static function getName(): string;
public static function getTargetEntityClass(): string;
/**
* @param T $entity
*/
public function migrate(MigrationTargetEntityInterface $entity): void;
/**
* @param T $entity
*/
public function needMigration(MigrationTargetEntityInterface $entity): bool;
/**
* Return all entity that need migration. A migrate command will be sent to queue for each of them.
*
* @return iterable<T>
*/
public function findAllThatNeedMigration(): iterable;
/**
* Return the number of entities that need migration or null if unknown.
*/
public function countAllThatNeedMigration(): ?int;
/**
* Return a boolean to indicate that no more entities need migration.
*/
public function migrationIsCompleted(): bool;
}