1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace SlayerBirden\DataFlowServer\Authentication\Entities; |
5
|
|
|
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use SlayerBirden\DataFlowServer\Domain\Entities\ClaimedResourceInterface; |
8
|
|
|
use SlayerBirden\DataFlowServer\Domain\Entities\User; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity() |
12
|
|
|
* @ORM\Table(name="passwords") |
13
|
|
|
*/ |
14
|
|
|
class Password implements ClaimedResourceInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @ORM\Id() |
18
|
|
|
* @ORM\GeneratedValue() |
19
|
|
|
* @ORM\Column(type="integer") |
20
|
|
|
* @var integer |
21
|
|
|
*/ |
22
|
|
|
private $id; |
23
|
|
|
/** |
24
|
|
|
* @ORM\Column(type="string", nullable=false) |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
private $hash; |
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(type="datetime") |
30
|
|
|
* @var \DateTime |
31
|
|
|
*/ |
32
|
|
|
private $createdAt; |
33
|
|
|
/** |
34
|
|
|
* @ORM\Column(type="datetime", nullable=false) |
35
|
|
|
* @var \DateTime |
36
|
|
|
*/ |
37
|
|
|
private $due; |
38
|
|
|
/** |
39
|
|
|
* @ORM\Column(type="boolean", nullable=false) |
40
|
|
|
* @var boolean |
41
|
|
|
*/ |
42
|
|
|
private $active = false; |
43
|
|
|
/** |
44
|
|
|
* @ORM\ManyToOne(targetEntity="\SlayerBirden\DataFlowServer\Domain\Entities\User") |
45
|
|
|
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE") |
46
|
|
|
* @var User |
47
|
|
|
*/ |
48
|
|
|
private $owner; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return int |
52
|
|
|
*/ |
53
|
4 |
|
public function getId(): int |
54
|
|
|
{ |
55
|
4 |
|
return $this->id; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
16 |
|
public function getHash(): string |
62
|
|
|
{ |
63
|
16 |
|
return $this->hash; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param string $hash |
68
|
|
|
*/ |
69
|
4 |
|
public function setHash(string $hash): void |
70
|
|
|
{ |
71
|
4 |
|
$this->hash = $hash; |
72
|
4 |
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return \DateTime |
76
|
|
|
*/ |
77
|
4 |
|
public function getCreatedAt(): \DateTime |
78
|
|
|
{ |
79
|
4 |
|
return $this->createdAt; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param \DateTime $createdAt |
84
|
|
|
*/ |
85
|
4 |
|
public function setCreatedAt(\DateTime $createdAt): void |
86
|
|
|
{ |
87
|
4 |
|
$this->createdAt = $createdAt; |
88
|
4 |
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return \DateTime |
92
|
|
|
*/ |
93
|
16 |
|
public function getDue(): \DateTime |
94
|
|
|
{ |
95
|
16 |
|
return $this->due; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param \DateTime $due |
100
|
|
|
*/ |
101
|
4 |
|
public function setDue(\DateTime $due): void |
102
|
|
|
{ |
103
|
4 |
|
$this->due = $due; |
104
|
4 |
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return bool |
108
|
|
|
*/ |
109
|
6 |
|
public function isActive(): bool |
110
|
|
|
{ |
111
|
6 |
|
return $this->active; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param bool $active |
116
|
|
|
*/ |
117
|
6 |
|
public function setActive(bool $active): void |
118
|
|
|
{ |
119
|
6 |
|
$this->active = $active; |
120
|
6 |
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return User |
124
|
|
|
*/ |
125
|
4 |
|
public function getOwner(): User |
126
|
|
|
{ |
127
|
4 |
|
return $this->owner; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param User $owner |
132
|
|
|
*/ |
133
|
4 |
|
public function setOwner(User $owner): void |
134
|
|
|
{ |
135
|
4 |
|
$this->owner = $owner; |
136
|
4 |
|
} |
137
|
|
|
} |
138
|
|
|
|