1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Azine\EmailBundle\Entity; |
4
|
|
|
|
5
|
|
|
use FOS\UserBundle\Model\User; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* ExampleUser |
9
|
|
|
* This class is only an example. Implement your own! |
10
|
|
|
* |
11
|
|
|
* @codeCoverageIgnore |
12
|
|
|
*/ |
13
|
|
|
class ExampleUser extends User implements RecipientInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var int |
17
|
|
|
*/ |
18
|
|
|
protected $id; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Set some defaults. |
22
|
|
|
*/ |
23
|
|
|
public function __construct() |
24
|
|
|
{ |
25
|
|
|
parent::__construct(); |
26
|
|
|
$this->setNotificationMode(RecipientInterface::NOTIFICATION_MODE_IMMEDIATELY); |
27
|
|
|
$this->setNewsletter(true); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return string representation of this user |
32
|
|
|
*/ |
33
|
|
|
public function getDisplayName() |
34
|
|
|
{ |
35
|
|
|
$firstName = $this->getFirstName(); |
36
|
|
|
$lastName = $this->getLastName(); |
37
|
|
|
$username = $this->getUsername(); |
38
|
|
|
|
39
|
|
|
$displayName = $username; |
40
|
|
|
if ($firstName) { |
41
|
|
|
$displayName = $firstName; |
42
|
|
|
} elseif ($lastName) { |
43
|
|
|
$displayName = $this->getSalutation().' '.$lastName; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
return ucwords($displayName); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/////////////////////////////////////////////////////////////////// |
50
|
|
|
// generated stuff only below this line. |
51
|
|
|
// @codeCoverageIgnoreStart |
52
|
|
|
/////////////////////////////////////////////////////////////////// |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
private $first_name; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string |
61
|
|
|
*/ |
62
|
|
|
private $last_name; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var string |
66
|
|
|
*/ |
67
|
|
|
private $salutation; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
private $preferredLocale; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var int |
76
|
|
|
*/ |
77
|
|
|
private $notification_mode; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var bool |
81
|
|
|
*/ |
82
|
|
|
private $newsletter; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set first_name. |
86
|
|
|
* |
87
|
|
|
* @param string $firstName |
88
|
|
|
* |
89
|
|
|
* @return ExampleUser |
90
|
|
|
*/ |
91
|
|
|
public function setFirstName($firstName) |
92
|
|
|
{ |
93
|
|
|
$this->first_name = $firstName; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get first_name. |
100
|
|
|
* |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getFirstName() |
104
|
|
|
{ |
105
|
|
|
return $this->first_name; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Set last_name. |
110
|
|
|
* |
111
|
|
|
* @param string $lastName |
112
|
|
|
* |
113
|
|
|
* @return ExampleUser |
114
|
|
|
*/ |
115
|
|
|
public function setLastName($lastName) |
116
|
|
|
{ |
117
|
|
|
$this->last_name = $lastName; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get last_name. |
124
|
|
|
* |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public function getLastName() |
128
|
|
|
{ |
129
|
|
|
return $this->last_name; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Set salutation. |
134
|
|
|
* |
135
|
|
|
* @param string $salutation |
136
|
|
|
* |
137
|
|
|
* @return ExampleUser |
138
|
|
|
*/ |
139
|
|
|
public function setSalutation($salutation) |
140
|
|
|
{ |
141
|
|
|
$this->salutation = $salutation; |
142
|
|
|
|
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Get salutation. |
148
|
|
|
* |
149
|
|
|
* @return string |
150
|
|
|
*/ |
151
|
|
|
public function getSalutation() |
152
|
|
|
{ |
153
|
|
|
return $this->salutation; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Set preferredLocale. |
158
|
|
|
* |
159
|
|
|
* @param string $preferredLocale |
160
|
|
|
* |
161
|
|
|
* @return ExampleUser |
162
|
|
|
*/ |
163
|
|
|
public function setPreferredLocale($preferredLocale) |
164
|
|
|
{ |
165
|
|
|
$this->preferredLocale = $preferredLocale; |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Get preferredLocale. |
172
|
|
|
* |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
|
|
public function getPreferredLocale() |
176
|
|
|
{ |
177
|
|
|
return $this->preferredLocale; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Set notification_mode. |
182
|
|
|
* |
183
|
|
|
* @param int $notificationMode |
184
|
|
|
* |
185
|
|
|
* @return ExampleUser |
186
|
|
|
*/ |
187
|
|
|
public function setNotificationMode($notificationMode) |
188
|
|
|
{ |
189
|
|
|
$this->notification_mode = $notificationMode; |
190
|
|
|
|
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Get notification_mode. |
196
|
|
|
* |
197
|
|
|
* @return int |
198
|
|
|
*/ |
199
|
|
|
public function getNotificationMode() |
200
|
|
|
{ |
201
|
|
|
return $this->notification_mode; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* Set newsletter. |
206
|
|
|
* |
207
|
|
|
* @param bool $newsletter |
208
|
|
|
* |
209
|
|
|
* @return ExampleUser |
210
|
|
|
*/ |
211
|
|
|
public function setNewsletter($newsletter) |
212
|
|
|
{ |
213
|
|
|
$this->newsletter = $newsletter; |
214
|
|
|
|
215
|
|
|
return $this; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* Get newsletter. |
220
|
|
|
* |
221
|
|
|
* @return bool |
222
|
|
|
*/ |
223
|
|
|
public function getNewsletter() |
224
|
|
|
{ |
225
|
|
|
return $this->newsletter; |
226
|
|
|
} |
227
|
|
|
} |
228
|
|
|
|