Passed
Push — 1.10.x ( 2b22bb...d25e30 )
by
unknown
52:09
created

SessionRelUser::setUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Entity;
5
6
use Chamilo\UserBundle\Entity\User;
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * SessionRelUser
11
 *
12
 * @ORM\Table(
13
 *    name="session_rel_user",
14
 *      indexes={
15
 *          @ORM\Index(name="idx_session_rel_user_id_user_moved", columns={"user_id", "moved_to"})
16
 *      }
17
 * )
18
 * @ORM\Entity
19
 */
20
class SessionRelUser
21
{
22
    /**
23
     * @var integer
24
     *
25
     * @ORM\Column(name="id", type="integer")
26
     * @ORM\Id
27
     * @ORM\GeneratedValue
28
     */
29
    private $iid;
0 ignored issues
show
Unused Code introduced by
The property $iid is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
30
31
    /**
32
     * @ORM\ManyToOne(targetEntity="Session", inversedBy="users", cascade={"persist"})
33
     * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
34
     */
35
    private $session;
36
37
    /**
38
     * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="users", cascade={"persist"})
39
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
40
     */
41
    private $user;
42
43
    /**
44
     * @var integer
45
     *
46
     * @ORM\Column(name="relation_type", type="integer", nullable=false, unique=false)
47
     */
48
    private $relationType;
49
50
    /**
51
     * @var integer
52
     *
53
     * @ORM\Column(name="duration", type="integer", nullable=true)
54
     */
55
    private $duration;
56
57
    /**
58
     * @var integer
59
     *
60
     * @ORM\Column(name="moved_to", type="integer", nullable=true, unique=false)
61
     */
62
    private $movedTo;
63
64
    /**
65
     * @var integer
66
     *
67
     * @ORM\Column(name="moved_status", type="integer", nullable=true, unique=false)
68
     */
69
    private $movedStatus;
70
71
    /**
72
     * @var \DateTime
73
     *
74
     * @ORM\Column(name="moved_at", type="datetime", nullable=true, unique=false)
75
     */
76
    private $movedAt;
77
78
    /**
79
     * @var \DateTime
80
     * @ORM\Column(name="registered_at", type="datetime", nullable=false, unique=false)
81
     */
82
    private $registeredAt;
83
84
    public $relationTypeList = array(
85
        0 => 'student',
86
        1 => 'drh'
87
    );
88
89
    /**
90
     * Constructor
91
     */
92
    public function __construct()
93
    {
94
        $this->moved_to = null;
95
        $this->movedStatus = null;
96
        $this->movedAt = null;
97
        $this->registeredAt = new \DateTime('now', new \DateTimeZone('UTC'));
98
    }
99
100
    /**
101
     * Set Session
102
     *
103
     * @param Session $session
104
     *
105
     * @return SessionRelUser
106
     */
107
    public function setSession($session)
108
    {
109
        $this->session = $session;
110
111
        return $this;
112
    }
113
114
    /**
115
     * Get Session
116
     *
117
     * @return Session
118
     */
119
    public function getSession()
120
    {
121
        return $this->session;
122
    }
123
124
    /**
125
     * Set User
126
     *
127
     * @param User $user
128
     * @return SessionRelUser
129
     */
130
    public function setUser($user)
131
    {
132
        $this->user = $user;
133
134
        return $this;
135
    }
136
137
    /**
138
     * Get idUser
139
     *
140
     * @return User
141
     */
142
    public function getUser()
143
    {
144
        return $this->user;
145
    }
146
147
    /**
148
     * Set relationType
149
     *
150
     * @param integer $relationType
151
     * @return SessionRelUser
152
     */
153
    public function setRelationType($relationType)
154
    {
155
        $this->relationType = $relationType;
156
157
        return $this;
158
    }
159
160
    /**
161
     * Set relationTypeByName
162
     *
163
     * @param string $relationType
164
     * @return SessionRelUser
165
     */
166
    public function setRelationTypeByName($relationType)
167
    {
168
        if (isset($this->relationTypeList[$relationType])) {
169
            $this->setRelationType($this->relationTypeList[$relationType]);
170
        }
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get relationType
177
     *
178
     * @return integer
179
     */
180
    public function getRelationType()
181
    {
182
        return $this->relationType;
183
    }
184
185
    /**
186
     * Set movedTo
187
     *
188
     * @param integer $movedTo
189
     * @return SessionRelUser
190
     */
191
    public function setMovedTo($movedTo)
192
    {
193
        $this->movedTo = $movedTo;
194
195
        return $this;
196
    }
197
198
    /**
199
     * Get movedTo
200
     *
201
     * @return integer
202
     */
203
    public function getMovedTo()
204
    {
205
        return $this->movedTo;
206
    }
207
208
    /**
209
     * Set movedStatus
210
     *
211
     * @param integer $movedStatus
212
     * @return SessionRelUser
213
     */
214
    public function setMovedStatus($movedStatus)
215
    {
216
        $this->movedStatus = $movedStatus;
217
218
        return $this;
219
    }
220
221
    /**
222
     * Get movedStatus
223
     *
224
     * @return integer
225
     */
226
    public function getMovedStatus()
227
    {
228
        return $this->movedStatus;
229
    }
230
231
    /**
232
     * Set movedAt
233
     *
234
     * @param \DateTime $movedAt
235
     *
236
     * @return SessionRelUser
237
     */
238
    public function setMovedAt($movedAt)
239
    {
240
        $this->movedAt = $movedAt;
241
242
        return $this;
243
    }
244
245
    /**
246
     * Get movedAt
247
     *
248
     * @return \DateTime
249
     */
250
    public function getMovedAt()
251
    {
252
        return $this->movedAt;
253
    }
254
255
    /**
256
     * Set registeredAt
257
     * @param \DateTime $registeredAt
258
     *
259
     * @return $this
260
     */
261
    public function setRegisteredAt(\DateTime $registeredAt)
262
    {
263
        $this->registeredAt = $registeredAt;
264
265
        return $this;
266
    }
267
268
    /**
269
     * Get registeredAt
270
     * @return \DateTime
271
     */
272
    public function getRegisteredAt()
273
    {
274
        return $this->registeredAt;
275
    }
276
277
    /**
278
     * @return int
279
     */
280
    public function getDuration()
281
    {
282
        return $this->duration;
283
    }
284
285
    /**
286
     * @param int $duration
287
     * @return SessionRelUser
288
     */
289
    public function setDuration($duration)
290
    {
291
        $this->duration = $duration;
292
293
        return $this;
294
    }
295
296
}
297