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