1 | <?php |
||
14 | class ConfirmationToken |
||
15 | { |
||
16 | const TYPE_CONFIRM_EMAIl = 'confirm_email'; |
||
17 | |||
18 | /** |
||
19 | * @ORM\Id() |
||
20 | * @ORM\GeneratedValue() |
||
21 | * @ORM\Column(type="integer") |
||
22 | */ |
||
23 | private $id; |
||
24 | |||
25 | /** |
||
26 | * @var $user User |
||
27 | * @ORM\ManyToOne(targetEntity="App\Entity\User") |
||
28 | */ |
||
29 | private $user; |
||
30 | |||
31 | /** |
||
32 | * @ORM\Column(type="string", length=32, unique=true) |
||
33 | */ |
||
34 | private $token; |
||
35 | |||
36 | /** |
||
37 | * @ORM\Column(type="string", length=256) |
||
38 | */ |
||
39 | private $type; |
||
40 | |||
41 | /** |
||
42 | * @ORM\Column(type="datetime", nullable=true) |
||
43 | */ |
||
44 | private $expires_at; |
||
45 | |||
46 | public static $validTypes = [self::TYPE_CONFIRM_EMAIl]; |
||
47 | |||
48 | 5 | public function __construct(User $user, $type) |
|
58 | |||
59 | /** |
||
60 | * @param \DateTimeInterface $expires_at |
||
61 | * @return ConfirmationToken |
||
62 | */ |
||
63 | 5 | public function setExpiresAt(\DateTimeInterface $expires_at) |
|
68 | |||
69 | /** |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function getId() |
||
76 | |||
77 | /** |
||
78 | * @return User |
||
79 | */ |
||
80 | 1 | public function getUser(): User |
|
84 | |||
85 | /** |
||
86 | * @return mixed |
||
87 | */ |
||
88 | 5 | public function getToken() |
|
92 | |||
93 | /** |
||
94 | * @return mixed |
||
95 | */ |
||
96 | public function getType() |
||
100 | |||
101 | /** |
||
102 | * @return mixed |
||
103 | */ |
||
104 | public function getExpiresAt() |
||
108 | } |