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