1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yawik\Migration\Entity; |
6
|
|
|
|
7
|
|
|
use DateTimeInterface; |
8
|
|
|
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ODM\Document(collection="migration") |
12
|
|
|
*/ |
13
|
|
|
class Migration |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @ODM\Id |
17
|
|
|
*/ |
18
|
|
|
private string $id; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @ODM\Field(type="string") |
22
|
|
|
*/ |
23
|
|
|
private string $class; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @ODM\Field(type="string") |
27
|
|
|
*/ |
28
|
|
|
private string $version; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @ODM\Field(type="string") |
32
|
|
|
*/ |
33
|
|
|
private string $description; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @ODM\Field(type="bool") |
37
|
|
|
*/ |
38
|
|
|
private bool $migrated; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @ODM\Field(type="date") |
42
|
|
|
*/ |
43
|
|
|
private ?DateTimeInterface $migratedAt; |
44
|
|
|
|
45
|
|
|
public function __construct( |
46
|
|
|
string $class, |
47
|
|
|
string $version, |
48
|
|
|
string $description, |
49
|
|
|
bool $migrated = false, |
50
|
|
|
?DateTimeInterface $migratedAt = null |
51
|
|
|
) |
52
|
|
|
{ |
53
|
|
|
$this->class = $class; |
54
|
|
|
$this->version = $version; |
55
|
|
|
$this->migrated = $migrated; |
56
|
|
|
$this->migratedAt = $migratedAt; |
57
|
|
|
$this->description = $description; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getId(): ?string |
61
|
|
|
{ |
62
|
|
|
return $this->id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getClass(): string |
66
|
|
|
{ |
67
|
|
|
return $this->class; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function getDescription(): string |
74
|
|
|
{ |
75
|
|
|
return $this->description; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getVersion(): string |
79
|
|
|
{ |
80
|
|
|
return $this->version; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function isMigrated(): bool |
84
|
|
|
{ |
85
|
|
|
return $this->migrated; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function setMigrated(bool $state) |
89
|
|
|
{ |
90
|
|
|
$this->migrated = $state; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function setMigratedAt(\DateTimeInterface $date) |
94
|
|
|
{ |
95
|
|
|
$this->migratedAt = $date; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getMigratedAt(): ?DateTimeInterface |
99
|
|
|
{ |
100
|
|
|
return $this->migratedAt; |
101
|
|
|
} |
102
|
|
|
} |