1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fi\CoreBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\Common\Collections\Collection; |
7
|
|
|
use FOS\UserBundle\Model\User as BaseUser; |
8
|
|
|
use Symfony\Component\Security\Core\User\EquatableInterface; |
9
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @ORM\Entity(repositoryClass="Fi\CoreBundle\Entity\OperatoriRepository") |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Operatori. |
17
|
|
|
*/ |
18
|
|
|
class Operatori extends BaseUser implements EquatableInterface |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
*/ |
24
|
|
|
protected $id; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $operatore; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var int |
33
|
|
|
*/ |
34
|
|
|
private $ruoli_id; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var Collection |
38
|
|
|
*/ |
39
|
|
|
private $permessis; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var Collection |
43
|
|
|
*/ |
44
|
|
|
private $storicomodifiches; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var Collection |
48
|
|
|
*/ |
49
|
|
|
private $tabelles; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \Fi\CoreBundle\Entity\ruoli |
53
|
|
|
*/ |
54
|
|
|
private $ruoli; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Constructor. |
58
|
|
|
*/ |
59
|
5 |
|
public function __construct() |
60
|
|
|
{ |
61
|
5 |
|
$this->permessis = new ArrayCollection(); |
62
|
5 |
|
$this->tabelles = new ArrayCollection(); |
63
|
5 |
|
parent::__construct(); |
64
|
5 |
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Get id. |
68
|
|
|
* |
69
|
|
|
* @return int |
70
|
|
|
*/ |
71
|
37 |
|
public function getId() |
72
|
|
|
{ |
73
|
37 |
|
return $this->id; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Set operatore. |
78
|
|
|
* |
79
|
|
|
* @param string $operatore |
80
|
|
|
* |
81
|
|
|
* @return operatori |
82
|
|
|
*/ |
83
|
3 |
|
public function setOperatore($operatore) |
84
|
|
|
{ |
85
|
3 |
|
$this->operatore = $operatore; |
86
|
|
|
|
87
|
3 |
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get operatore. |
92
|
|
|
* |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
35 |
|
public function getOperatore() |
96
|
|
|
{ |
97
|
35 |
|
return $this->operatore; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Set ruoli_id. |
102
|
|
|
* |
103
|
|
|
* @param int $ruoliId |
104
|
|
|
* |
105
|
|
|
* @return operatori |
106
|
|
|
*/ |
107
|
|
|
public function setRuoliId($ruoliId) |
108
|
|
|
{ |
109
|
|
|
$this->ruoli_id = $ruoliId; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Get ruoli_id. |
116
|
|
|
* |
117
|
|
|
* @return int |
118
|
|
|
*/ |
119
|
1 |
|
public function getRuoliId() |
120
|
|
|
{ |
121
|
1 |
|
return $this->ruoli_id; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Add permessis. |
126
|
|
|
* |
127
|
|
|
* @param \Fi\CoreBundle\Entity\permessi $permessis |
128
|
|
|
* |
129
|
|
|
* @return operatori |
130
|
|
|
*/ |
131
|
|
|
public function addPermessi(\Fi\CoreBundle\Entity\permessi $permessis) |
132
|
|
|
{ |
133
|
|
|
$this->permessis[] = $permessis; |
134
|
|
|
|
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Get permessis. |
140
|
|
|
* |
141
|
|
|
* @return Collection |
142
|
|
|
*/ |
143
|
|
|
public function getPermessis() |
144
|
|
|
{ |
145
|
|
|
return $this->permessis; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Remove permessis. |
150
|
|
|
* |
151
|
|
|
* @param \Fi\CoreBundle\Entity\permessi $permessis |
152
|
|
|
*/ |
153
|
|
|
public function removePermessi(\Fi\CoreBundle\Entity\permessi $permessis) |
154
|
|
|
{ |
155
|
|
|
$this->permessis->removeElement($permessis); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get storicomodifiches. |
160
|
|
|
* |
161
|
|
|
* @return Collection |
162
|
|
|
*/ |
163
|
|
|
public function getStoricomodicihes() |
164
|
|
|
{ |
165
|
|
|
return $this->storicomodifiches; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Add storicomodifiches. |
170
|
|
|
* |
171
|
|
|
* @param \Fi\CoreBundle\Entity\storicomodifiche $storicomodifiches |
172
|
|
|
* |
173
|
|
|
* @return operatori |
174
|
|
|
*/ |
175
|
|
|
public function addStoricomodifiche(Storicomodifiche $storicomodifiches) |
176
|
|
|
{ |
177
|
|
|
$this->storicomodifiches[] = $storicomodifiches; |
178
|
|
|
|
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Remove permessis. |
184
|
|
|
* |
185
|
|
|
* @param \Fi\CoreBundle\Entity\storicomodifiche $storicomodifiches |
186
|
|
|
*/ |
187
|
|
|
public function removeStoricomodicihe(Storicomodifiche $storicomodifiches) |
188
|
|
|
{ |
189
|
|
|
$this->storicomodifiches->removeElement($storicomodifiches); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Add tabelles. |
194
|
|
|
* |
195
|
|
|
* @param \Fi\CoreBundle\Entity\tabelle $tabelles |
196
|
|
|
* |
197
|
|
|
* @return operatori |
198
|
|
|
*/ |
199
|
|
|
public function addTabelle(\Fi\CoreBundle\Entity\tabelle $tabelles) |
200
|
|
|
{ |
201
|
|
|
$this->tabelles[] = $tabelles; |
202
|
|
|
|
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Remove tabelles. |
208
|
|
|
* |
209
|
|
|
* @param \Fi\CoreBundle\Entity\tabelle $tabelles |
210
|
|
|
*/ |
211
|
|
|
public function removeTabelle(\Fi\CoreBundle\Entity\tabelle $tabelles) |
212
|
|
|
{ |
213
|
|
|
$this->tabelles->removeElement($tabelles); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Get tabelles. |
218
|
|
|
* |
219
|
|
|
* @return Collection |
220
|
|
|
*/ |
221
|
|
|
public function getTabelles() |
222
|
|
|
{ |
223
|
|
|
return $this->tabelles; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Set ruoli. |
228
|
|
|
* |
229
|
|
|
* @param \Fi\CoreBundle\Entity\ruoli $ruoli |
230
|
|
|
* |
231
|
|
|
* @return operatori |
232
|
|
|
*/ |
233
|
3 |
|
public function setRuoli(\Fi\CoreBundle\Entity\ruoli $ruoli = null) |
234
|
|
|
{ |
235
|
3 |
|
$this->ruoli = $ruoli; |
236
|
|
|
|
237
|
3 |
|
return $this; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Get ruoli. |
242
|
|
|
* |
243
|
|
|
* @return \Fi\CoreBundle\Entity\ruoli |
244
|
|
|
*/ |
245
|
34 |
|
public function getRuoli() |
246
|
|
|
{ |
247
|
34 |
|
return $this->ruoli; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
public function __toString() |
251
|
|
|
{ |
252
|
|
|
if ($this->getOperatore()) { |
253
|
|
|
return $this->getOperatore(); |
254
|
|
|
} else { |
255
|
|
|
//return ''; |
256
|
|
|
return $this->getUsername(); |
257
|
|
|
} |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Add storicomodifich |
262
|
|
|
* |
263
|
|
|
* @param Storicomodifiche $storicomodifich |
264
|
|
|
* |
265
|
|
|
* @return Operatori |
266
|
|
|
*/ |
267
|
|
|
public function addStoricomodifich(Storicomodifiche $storicomodifich) |
268
|
|
|
{ |
269
|
|
|
$this->storicomodifiches[] = $storicomodifich; |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* Remove storicomodifich |
276
|
|
|
* |
277
|
|
|
* @param Storicomodifiche $storicomodifich |
278
|
|
|
*/ |
279
|
|
|
public function removeStoricomodifich(Storicomodifiche $storicomodifich) |
280
|
|
|
{ |
281
|
|
|
$this->storicomodifiches->removeElement($storicomodifich); |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* Get storicomodifiches |
286
|
|
|
* |
287
|
|
|
* @return Collection |
288
|
|
|
*/ |
289
|
|
|
public function getStoricomodifiches() |
290
|
|
|
{ |
291
|
|
|
return $this->storicomodifiches; |
292
|
|
|
} |
293
|
|
|
|
294
|
31 |
|
public function isEqualTo(UserInterface $user) |
295
|
|
|
{ |
296
|
31 |
|
if ($this->password !== $user->getPassword()) { |
297
|
|
|
return false; |
298
|
|
|
} |
299
|
|
|
|
300
|
31 |
|
if ($this->salt !== $user->getSalt()) { |
301
|
|
|
return false; |
302
|
|
|
} |
303
|
|
|
|
304
|
31 |
|
if ($this->username !== $user->getUsername()) { |
305
|
|
|
return false; |
306
|
|
|
} |
307
|
|
|
|
308
|
31 |
|
return true; |
309
|
|
|
} |
310
|
|
|
} |
311
|
|
|
|