Operatori::setRuoliId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cdf\BiCoreBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Doctrine\Common\Collections\ArrayCollection;
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
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
11
12
/**
13
 * Cdf\BiCoreBundle\Entity\Operatori.
14
 *
15
 * @ORM\Entity()
16
 * @ORM\Table(name="Operatori", indexes={@ORM\Index(name="fk_operatori_ruoli2_idx", columns={"ruoli_id"})})
17
 */
18
class Operatori extends BaseUser implements EquatableInterface, UserInterface, PasswordAuthenticatedUserInterface
19
{
20
21
    /**
22
     * @ORM\Id
23
     * @ORM\Column(type="integer")
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    protected $id;
27
28
    /**
29
     * @ORM\Column(type="string", length=255, nullable=true)
30
     */
31
    protected $operatore;
32
33
    /**
34
     * @ORM\Column(type="integer", nullable=true)
35
     */
36
    protected $ruoli_id;
37
38
    /**
39
     * @ORM\OneToMany(targetEntity="Colonnetabelle", mappedBy="operatori")
40
     * @ORM\JoinColumn(name="id", referencedColumnName="operatori_id", nullable=false)
41
     */
42
    protected $colonnetabelles;
43
44
    /**
45
     * @ORM\OneToMany(targetEntity="Permessi", mappedBy="operatori")
46
     * @ORM\JoinColumn(name="id", referencedColumnName="operatori_id", nullable=false)
47
     */
48
    protected $permessis;
49
50
    /**
51
     * @ORM\OneToMany(targetEntity="Storicomodifiche", mappedBy="operatori")
52
     * @ORM\JoinColumn(name="id", referencedColumnName="operatori_id", nullable=false)
53
     */
54
    protected $storicomodifiches;
55
56
    /**
57
     * @ORM\ManyToOne(targetEntity="Ruoli", inversedBy="operatoris")
58
     * @ORM\JoinColumn(name="ruoli_id", referencedColumnName="id")
59
     */
60
    protected $ruoli;
61
62 3
    public function __construct()
63
    {
64 3
        $this->colonnetabelles = new ArrayCollection();
65 3
        $this->permessis = new ArrayCollection();
66 3
        $this->storicomodifiches = new ArrayCollection();
67 3
        parent::__construct();
68
    }
69
70
    /**
71
     * Set the value of id.
72
     *
73
     * @param int $id
74
     *
75
     * @return \Cdf\BiCoreBundle\Entity\Operatori
76
     */
77
    public function setId($id) : \Cdf\BiCoreBundle\Entity\Operatori
78
    {
79
        $this->id = $id;
80
81
        return $this;
82
    }
83
84
    /**
85
     * Get the value of id.
86
     *
87
     * @return int
88
     */
89 22
    public function getId() : int
90
    {
91 22
        return $this->id;
92
    }
93
94
    /**
95
     * Set the value of operatore.
96
     *
97
     * @param string $operatore
98
     *
99
     * @return \Cdf\BiCoreBundle\Entity\Operatori
100
     */
101 3
    public function setOperatore($operatore) : \Cdf\BiCoreBundle\Entity\Operatori
102
    {
103 3
        $this->operatore = $operatore;
104
105 3
        return $this;
106
    }
107
108
    /**
109
     * Get the value of operatore.
110
     *
111
     * @return string
112
     */
113 2
    public function getOperatore() : ?string
114
    {
115 2
        return $this->operatore;
116
    }
117
118
    /**
119
     * Set the value of ruoli_id.
120
     *
121
     * @param int $ruoli_id
122
     *
123
     * @return \Cdf\BiCoreBundle\Entity\Operatori
124
     */
125
    public function setRuoliId($ruoli_id) : \Cdf\BiCoreBundle\Entity\Operatori
126
    {
127
        $this->ruoli_id = $ruoli_id;
128
129
        return $this;
130
    }
131
132
    /**
133
     * Get the value of ruoli_id.
134
     *
135
     * @return ?int
136
     */
137 1
    public function getRuoliId() : ?int
138
    {
139 1
        return $this->ruoli_id;
140
    }
141
142
    /**
143
     * Add Colonnetabelle entity to collection (one to many).
144
     *
145
     * @param \Cdf\BiCoreBundle\Entity\Colonnetabelle $colonnetabelle
146
     *
147
     * @return \Cdf\BiCoreBundle\Entity\Operatori
148
     */
149
    public function addColonnetabelle(Colonnetabelle $colonnetabelle) : \Cdf\BiCoreBundle\Entity\Operatori
150
    {
151
        $this->colonnetabelles[] = $colonnetabelle;
152
153
        return $this;
154
    }
155
156
    /**
157
     * Remove Colonnetabelle entity from collection (one to many).
158
     *
159
     * @param \Cdf\BiCoreBundle\Entity\Colonnetabelle $colonnetabelle
160
     *
161
     * @return \Cdf\BiCoreBundle\Entity\Operatori
162
     */
163
    public function removeColonnetabelle(Colonnetabelle $colonnetabelle) : \Cdf\BiCoreBundle\Entity\Operatori
164
    {
165
        $this->colonnetabelles->removeElement($colonnetabelle);
166
167
        return $this;
168
    }
169
170
    /**
171
     * Get Colonnetabelle entity collection (one to many).
172
     *
173
     * @return \Doctrine\Common\Collections\Collection
174
     */
175
    public function getColonnetabelles() : \Doctrine\Common\Collections\Collection
176
    {
177
        return $this->colonnetabelles;
178
    }
179
180
    /**
181
     * Add Permessi entity to collection (one to many).
182
     *
183
     * @param \Cdf\BiCoreBundle\Entity\Permessi $permessi
184
     *
185
     * @return \Cdf\BiCoreBundle\Entity\Operatori
186
     */
187
    public function addPermessi(Permessi $permessi) : \Cdf\BiCoreBundle\Entity\Operatori
188
    {
189
        $this->permessis[] = $permessi;
190
191
        return $this;
192
    }
193
194
    /**
195
     * Remove Permessi entity from collection (one to many).
196
     *
197
     * @param \Cdf\BiCoreBundle\Entity\Permessi $permessi
198
     *
199
     * @return \Cdf\BiCoreBundle\Entity\Operatori
200
     */
201
    public function removePermessi(Permessi $permessi) :\Cdf\BiCoreBundle\Entity\Operatori
202
    {
203
        $this->permessis->removeElement($permessi);
204
205
        return $this;
206
    }
207
208
    /**
209
     * Get Permessi entity collection (one to many).
210
     *
211
     * @return \Doctrine\Common\Collections\Collection
212
     */
213
    public function getPermessis(): \Doctrine\Common\Collections\Collection
214
    {
215
        return $this->permessis;
216
    }
217
218
    /**
219
     * Add Storicomodifiche entity to collection (one to many).
220
     *
221
     * @param \Cdf\BiCoreBundle\Entity\Storicomodifiche $storicomodifiche
222
     *
223
     * @return \Cdf\BiCoreBundle\Entity\Operatori
224
     */
225
    public function addStoricomodifiche(Storicomodifiche $storicomodifiche) : \Cdf\BiCoreBundle\Entity\Operatori
226
    {
227
        $this->storicomodifiches[] = $storicomodifiche;
228
229
        return $this;
230
    }
231
232
    /**
233
     * Remove Storicomodifiche entity from collection (one to many).
234
     *
235
     * @param \Cdf\BiCoreBundle\Entity\Storicomodifiche $storicomodifiche
236
     *
237
     * @return \Cdf\BiCoreBundle\Entity\Operatori
238
     */
239
    public function removeStoricomodifiche(Storicomodifiche $storicomodifiche) : \Cdf\BiCoreBundle\Entity\Operatori
240
    {
241
        $this->storicomodifiches->removeElement($storicomodifiche);
242
243
        return $this;
244
    }
245
246
    /**
247
     * Get Storicomodifiche entity collection (one to many).
248
     *
249
     * @return \Doctrine\Common\Collections\Collection
250
     */
251
    public function getStoricomodifiches() : \Doctrine\Common\Collections\Collection
252
    {
253
        return $this->storicomodifiches;
254
    }
255
256
    /**
257
     * Set Ruoli entity (many to one).
258
     *
259
     * @param \Cdf\BiCoreBundle\Entity\Ruoli $ruoli
260
     *
261
     * @return \Cdf\BiCoreBundle\Entity\Operatori
262
     */
263 2
    public function setRuoli(Ruoli $ruoli = null): \Cdf\BiCoreBundle\Entity\Operatori
264
    {
265 2
        $this->ruoli = $ruoli;
266
267 2
        return $this;
268
    }
269
270
    /**
271
     * Get Ruoli entity (many to one).
272
     *
273
     * @return \Cdf\BiCoreBundle\Entity\Ruoli
274
     */
275 24
    public function getRuoli() : ?\Cdf\BiCoreBundle\Entity\Ruoli
276
    {
277 24
        return $this->ruoli;
278
    }
279
280
    public function __sleep() : array
281
    {
282
        return array('id', 'operatore', 'ruoli_id');
283
    }
284
285 19
    public function isEqualTo(UserInterface $user) : bool
286
    {
287 19
        if ($this->password !== $user->getPassword()) {
288
            return false;
289
        }
290
291 19
        if ($this->salt !== $user->getSalt()) {
292
            return false;
293
        }
294
295 19
        if ($this->username !== $user->getUsername()) {
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Securi...nterface::getUsername() has been deprecated: since Symfony 5.3, use getUserIdentifier() instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

295
        if ($this->username !== /** @scrutinizer ignore-deprecated */ $user->getUsername()) {

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
296
            return false;
297
        }
298
299 19
        return true;
300
    }
301
302
    /**
303
     * @return string the identifier for this user
304
     */
305 19
    public function getUserIdentifier(): string
306
    {
307 19
        return $this->username;
308
    }
309
    
310
    /**
311
     * @return string the hashed password for this user
312
     */
313 20
    public function getPassword(): string
314
    {
315 20
        return $this->password;
316
    }
317
}
318