|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Del\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use DateTime; |
|
6
|
|
|
use Del\Value\User\State; |
|
7
|
|
|
use Del\Person\Entity\Person; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @MappedSuperclass() |
|
11
|
|
|
* @Entity(repositoryClass="Del\Repository\UserRepository") |
|
12
|
|
|
* @Table(name="User",uniqueConstraints={@UniqueConstraint(name="email_idx", columns={"email"})}) |
|
13
|
|
|
*/ |
|
14
|
|
|
class BaseUser |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @Id |
|
18
|
|
|
* @Column(type="integer") |
|
19
|
|
|
* @GeneratedValue |
|
20
|
|
|
*/ |
|
21
|
|
|
private $id; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @Column(type="string",length=50) |
|
25
|
|
|
*/ |
|
26
|
|
|
private $email; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @OneToOne(targetEntity="Del\Person\Entity\Person",cascade="persist") |
|
30
|
|
|
*/ |
|
31
|
|
|
private $person; |
|
32
|
|
|
|
|
33
|
|
|
/** @Column(type="string",length=100) */ |
|
34
|
|
|
private $password; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @Column(type="integer",length=1) |
|
38
|
|
|
* @var int |
|
39
|
|
|
*/ |
|
40
|
|
|
private $state; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @Column(type="date",nullable=true) |
|
44
|
|
|
* @var DateTime |
|
45
|
|
|
*/ |
|
46
|
|
|
private $registrationDate; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @Column(type="date",nullable=true) |
|
50
|
|
|
* @var DateTime |
|
51
|
|
|
*/ |
|
52
|
|
|
private $lastLoginDate; |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
31 |
|
public function __construct() |
|
56
|
|
|
{ |
|
57
|
31 |
|
$this->state = 0; |
|
58
|
31 |
|
} |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
6 |
|
public function getID() |
|
62
|
|
|
{ |
|
63
|
6 |
|
return $this->id; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return mixed |
|
68
|
|
|
*/ |
|
69
|
4 |
|
public function getEmail() |
|
70
|
|
|
{ |
|
71
|
4 |
|
return $this->email; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return Person |
|
76
|
|
|
*/ |
|
77
|
3 |
|
public function getPerson() |
|
78
|
|
|
{ |
|
79
|
3 |
|
return $this->person; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
|
|
83
|
3 |
|
public function getPassword() |
|
84
|
|
|
{ |
|
85
|
3 |
|
return $this->password; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return State |
|
90
|
|
|
*/ |
|
91
|
3 |
|
public function getState() |
|
92
|
|
|
{ |
|
93
|
3 |
|
return new State($this->state); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return DateTime |
|
98
|
|
|
*/ |
|
99
|
3 |
|
public function getRegistrationDate() |
|
100
|
|
|
{ |
|
101
|
3 |
|
return $this->registrationDate; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return DateTime |
|
106
|
|
|
*/ |
|
107
|
3 |
|
public function getLastLoginDate() |
|
108
|
|
|
{ |
|
109
|
3 |
|
return $this->lastLoginDate; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
5 |
|
public function setID($id) |
|
113
|
|
|
{ |
|
114
|
5 |
|
$this->id = $id; |
|
115
|
5 |
|
return $this; |
|
116
|
|
|
} |
|
117
|
|
|
/** |
|
118
|
|
|
* @param mixed $email |
|
119
|
|
|
* @return User |
|
120
|
|
|
*/ |
|
121
|
20 |
|
public function setEmail($email) |
|
122
|
|
|
{ |
|
123
|
20 |
|
$this->email = $email; |
|
124
|
20 |
|
return $this; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
19 |
|
public function setPerson(Person $person) |
|
128
|
|
|
{ |
|
129
|
19 |
|
$this->person = $person; |
|
130
|
19 |
|
return $this; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
19 |
|
public function setPassword($password) |
|
134
|
|
|
{ |
|
135
|
19 |
|
$this->password = $password; |
|
136
|
19 |
|
return $this; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @param State $state |
|
141
|
|
|
* @return User |
|
142
|
|
|
*/ |
|
143
|
19 |
|
public function setState(State $state) |
|
144
|
|
|
{ |
|
145
|
19 |
|
$this->state = $state->getValue(); |
|
146
|
19 |
|
return $this; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param DateTime $registrationDate |
|
151
|
|
|
* @return User |
|
152
|
|
|
*/ |
|
153
|
19 |
|
public function setRegistrationDate($registrationDate) |
|
154
|
|
|
{ |
|
155
|
19 |
|
$this->registrationDate = $registrationDate; |
|
156
|
19 |
|
return $this; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @param DateTime $lastLogin |
|
161
|
|
|
* @return User |
|
162
|
|
|
*/ |
|
163
|
19 |
|
public function setLastLogin(DateTime $lastLogin) |
|
164
|
|
|
{ |
|
165
|
19 |
|
$this->lastLoginDate = $lastLogin; |
|
166
|
19 |
|
return $this; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
} |