1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use JMS\Serializer\Annotation as Serializer; |
7
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
8
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
9
|
|
|
use JMS\Serializer\Annotation\Expose; |
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
11
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @ORM\Table(name="customers") |
15
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\CustomerRepository") |
16
|
|
|
* @UniqueEntity("facebookId") |
17
|
|
|
* @ExclusionPolicy("all") |
18
|
|
|
*/ |
19
|
|
|
class Customer implements UserInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
* |
24
|
|
|
* @ORM\Column(name="id", type="integer") |
25
|
|
|
* @ORM\Id |
26
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
27
|
|
|
*/ |
28
|
|
|
protected $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
* |
33
|
|
|
* @ORM\Column(name="first_name", type="string", length=100, nullable=true) |
34
|
|
|
* @Assert\Regex(pattern="/\d/", match=false) |
35
|
|
|
* @Assert\Type("string") |
36
|
|
|
* @Assert\Length(min=2, max=100) |
37
|
|
|
* @Assert\NotBlank( |
38
|
|
|
* message="not.blank" |
39
|
|
|
* ) |
40
|
|
|
* @Expose |
41
|
|
|
*/ |
42
|
|
|
protected $firstName; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(name="last_name", type="string", length=100, nullable=true) |
48
|
|
|
* @Assert\Regex(pattern="/\d/", match=false) |
49
|
|
|
* @Assert\Type("string") |
50
|
|
|
* @Assert\Length(min=2, max=100) |
51
|
|
|
* @Assert\NotBlank( |
52
|
|
|
* message="not.blank" |
53
|
|
|
* ) |
54
|
|
|
* @Expose |
55
|
|
|
*/ |
56
|
|
|
protected $lastName; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
* |
61
|
|
|
* @ORM\Column(name="email", type="string", length=100, nullable=true) |
62
|
|
|
* @Assert\Email() |
63
|
|
|
* @Assert\Type("string") |
64
|
|
|
* @Assert\Length(max=100) |
65
|
|
|
* @Assert\NotBlank( |
66
|
|
|
* message="not.blank" |
67
|
|
|
* ) |
68
|
|
|
* @Expose |
69
|
|
|
*/ |
70
|
|
|
protected $email; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var string |
74
|
|
|
* |
75
|
|
|
* @ORM\Column(name="username", type="string", length=100) |
76
|
|
|
* @Assert\Type("string") |
77
|
|
|
* @Assert\Length(max=100) |
78
|
|
|
*/ |
79
|
|
|
protected $username; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string |
83
|
|
|
* |
84
|
|
|
* @ORM\Column(name="api_key", type="string", length=255, nullable=true) |
85
|
|
|
* @Assert\Type("string") |
86
|
|
|
* @Assert\Length(max=255) |
87
|
|
|
*/ |
88
|
|
|
private $apiKey; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var string |
92
|
|
|
* |
93
|
|
|
* @ORM\Column(name="facebook_id", type="string", length=255, nullable=true, unique=true) |
94
|
|
|
* @Assert\Type("string") |
95
|
|
|
* @Assert\Length(max=255) |
96
|
|
|
*/ |
97
|
|
|
private $facebookId; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Get id. |
101
|
|
|
* |
102
|
|
|
* @return int |
103
|
|
|
*/ |
104
|
|
|
public function getId() |
105
|
|
|
{ |
106
|
|
|
return $this->id; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Set apiKey. |
111
|
|
|
* |
112
|
|
|
* @param string $apiKey |
113
|
|
|
* |
114
|
|
|
* @return Customer |
115
|
|
|
*/ |
116
|
|
|
public function setApiKey($apiKey) |
117
|
|
|
{ |
118
|
|
|
$this->apiKey = $apiKey; |
119
|
|
|
|
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Get apiKey. |
125
|
|
|
* |
126
|
|
|
* @return string |
127
|
|
|
*/ |
128
|
|
|
public function getApiKey() |
129
|
|
|
{ |
130
|
|
|
return $this->apiKey; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @inheritdoc |
135
|
|
|
*/ |
136
|
|
|
public function getRoles() |
137
|
|
|
{ |
138
|
|
|
return array('ROLE_API'); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @inheritdoc |
143
|
|
|
*/ |
144
|
|
|
public function getPassword() |
145
|
|
|
{ |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @inheritdoc |
150
|
|
|
*/ |
151
|
|
|
public function getSalt() |
152
|
|
|
{ |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @inheritdoc |
157
|
|
|
*/ |
158
|
|
|
public function eraseCredentials() |
159
|
|
|
{ |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Set facebookId. |
164
|
|
|
* |
165
|
|
|
* @param string $facebookId |
166
|
|
|
* |
167
|
|
|
* @return Customer |
168
|
|
|
*/ |
169
|
|
|
public function setFacebookId($facebookId) |
170
|
|
|
{ |
171
|
|
|
$this->facebookId = $facebookId; |
172
|
|
|
|
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get facebookId. |
178
|
|
|
* |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getFacebookId() |
182
|
|
|
{ |
183
|
|
|
return $this->facebookId; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Set username. |
188
|
|
|
* |
189
|
|
|
* @param string $username |
190
|
|
|
* |
191
|
|
|
* @return Customer |
192
|
|
|
*/ |
193
|
|
|
public function setUsername($username) |
194
|
|
|
{ |
195
|
|
|
$this->username = $username; |
196
|
|
|
|
197
|
|
|
return $this; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Get username. |
202
|
|
|
* |
203
|
|
|
* @return string |
204
|
|
|
*/ |
205
|
|
|
public function getUsername() |
206
|
|
|
{ |
207
|
|
|
return $this->username; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Set firstName. |
212
|
|
|
* |
213
|
|
|
* @param string $firstName |
214
|
|
|
* |
215
|
|
|
* @return Customer |
216
|
|
|
*/ |
217
|
|
|
public function setFirstName($firstName) |
218
|
|
|
{ |
219
|
|
|
$this->firstName = $firstName; |
220
|
|
|
|
221
|
|
|
return $this; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Get firstName. |
226
|
|
|
* |
227
|
|
|
* @return string |
228
|
|
|
*/ |
229
|
|
|
public function getFirstName() |
230
|
|
|
{ |
231
|
|
|
return $this->firstName; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Set lastName. |
236
|
|
|
* |
237
|
|
|
* @param string $lastName |
238
|
|
|
* |
239
|
|
|
* @return Customer |
240
|
|
|
*/ |
241
|
|
|
public function setLastName($lastName) |
242
|
|
|
{ |
243
|
|
|
$this->lastName = $lastName; |
244
|
|
|
|
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* Get lastName. |
250
|
|
|
* |
251
|
|
|
* @return string |
252
|
|
|
*/ |
253
|
|
|
public function getLastName() |
254
|
|
|
{ |
255
|
|
|
return $this->lastName; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* Set email. |
260
|
|
|
* |
261
|
|
|
* @param string $email |
262
|
|
|
* |
263
|
|
|
* @return Customer |
264
|
|
|
*/ |
265
|
|
|
public function setEmail($email) |
266
|
|
|
{ |
267
|
|
|
$this->email = $email; |
268
|
|
|
|
269
|
|
|
return $this; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Get email. |
274
|
|
|
* |
275
|
|
|
* @return string |
276
|
|
|
*/ |
277
|
|
|
public function getEmail() |
278
|
|
|
{ |
279
|
|
|
return $this->email; |
280
|
|
|
} |
281
|
|
|
} |
282
|
|
|
|