Completed
Push — master ( 784f70...96b7ea )
by Julito
10:23
created

CThematic::getResourceIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * CThematic.
14
 *
15
 * @ORM\Table(
16
 *  name="c_thematic",
17
 *  indexes={
18
 *      @ORM\Index(name="course", columns={"c_id"}),
19
 *      @ORM\Index(name="active", columns={"active", "session_id"})
20
 *  }
21
 * )
22
 * @ORM\Entity
23
 */
24
class CThematic extends AbstractResource implements ResourceInterface
25
{
26
    /**
27
     * @var int
28
     *
29
     * @ORM\Column(name="iid", type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue
32
     */
33
    protected $iid;
34
35
    /**
36
     * @var int
37
     *
38
     * @ORM\Column(name="c_id", type="integer")
39
     */
40
    protected $cId;
41
42
    /**
43
     * @var int
44
     *
45
     * @ORM\Column(name="id", type="integer", nullable=true)
46
     */
47
    protected $id;
48
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(name="title", type="text", nullable=false)
53
     */
54
    protected $title;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="content", type="text", nullable=true)
60
     */
61
    protected $content;
62
63
    /**
64
     * @var int
65
     *
66
     * @ORM\Column(name="display_order", type="integer", nullable=false)
67
     */
68
    protected $displayOrder;
69
70
    /**
71
     * @var bool
72
     *
73
     * @ORM\Column(name="active", type="boolean", nullable=false)
74
     */
75
    protected $active;
76
77
    /**
78
     * @var int
79
     *
80
     * @ORM\Column(name="session_id", type="integer", nullable=false)
81
     */
82
    protected $sessionId;
83
84
    /**
85
     * @var CThematicPlan[]
86
     *
87
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CThematicPlan", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true)
88
     */
89
    protected $plans;
90
91
    /**
92
     * @var CThematicAdvance[]
93
     *
94
     * @ORM\OrderBy({"startDate" = "ASC"})
95
     *
96
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CThematicAdvance", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true)
97
     */
98
    protected $advances;
99
100
    public function __construct()
101
    {
102
        $this->id = 0;
103
        $this->plans = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new Doctrine\Common\Collections\ArrayCollection() of type Doctrine\Common\Collections\ArrayCollection is incompatible with the declared type Chamilo\CourseBundle\Entity\CThematicPlan[] of property $plans.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
104
        $this->advances = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new Doctrine\Common\Collections\ArrayCollection() of type Doctrine\Common\Collections\ArrayCollection is incompatible with the declared type Chamilo\CourseBundle\Entity\CThematicAdvance[] of property $advances.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
105
    }
106
107
    /**
108
     * Set title.
109
     *
110
     * @param string $title
111
     *
112
     * @return CThematic
113
     */
114
    public function setTitle($title)
115
    {
116
        $this->title = $title;
117
118
        return $this;
119
    }
120
121
    /**
122
     * Get title.
123
     *
124
     * @return string
125
     */
126
    public function getTitle()
127
    {
128
        return $this->title;
129
    }
130
131
    /**
132
     * Set content.
133
     *
134
     * @param string $content
135
     *
136
     * @return CThematic
137
     */
138
    public function setContent($content)
139
    {
140
        $this->content = $content;
141
142
        return $this;
143
    }
144
145
    /**
146
     * Get content.
147
     *
148
     * @return string
149
     */
150
    public function getContent()
151
    {
152
        return $this->content;
153
    }
154
155
    /**
156
     * Set displayOrder.
157
     *
158
     * @param int $displayOrder
159
     *
160
     * @return CThematic
161
     */
162
    public function setDisplayOrder($displayOrder)
163
    {
164
        $this->displayOrder = $displayOrder;
165
166
        return $this;
167
    }
168
169
    /**
170
     * Get displayOrder.
171
     *
172
     * @return int
173
     */
174
    public function getDisplayOrder()
175
    {
176
        return $this->displayOrder;
177
    }
178
179
    /**
180
     * Set active.
181
     *
182
     * @param bool $active
183
     *
184
     * @return CThematic
185
     */
186
    public function setActive($active)
187
    {
188
        $this->active = $active;
189
190
        return $this;
191
    }
192
193
    /**
194
     * Get active.
195
     *
196
     * @return bool
197
     */
198
    public function getActive()
199
    {
200
        return $this->active;
201
    }
202
203
    /**
204
     * Set sessionId.
205
     *
206
     * @param int $sessionId
207
     *
208
     * @return CThematic
209
     */
210
    public function setSessionId($sessionId)
211
    {
212
        $this->sessionId = $sessionId;
213
214
        return $this;
215
    }
216
217
    /**
218
     * Get sessionId.
219
     *
220
     * @return int
221
     */
222
    public function getSessionId()
223
    {
224
        return $this->sessionId;
225
    }
226
227
    /**
228
     * Set id.
229
     *
230
     * @param int $id
231
     *
232
     * @return CThematic
233
     */
234
    public function setId($id)
235
    {
236
        $this->id = $id;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Get id.
243
     *
244
     * @return int
245
     */
246
    public function getId()
247
    {
248
        return $this->id;
249
    }
250
251
    /**
252
     * Set cId.
253
     *
254
     * @param int $cId
255
     *
256
     * @return CThematic
257
     */
258
    public function setCId($cId)
259
    {
260
        $this->cId = $cId;
261
262
        return $this;
263
    }
264
265
    public function getIid(): int
266
    {
267
        return $this->iid;
268
    }
269
270
    /**
271
     * Get cId.
272
     *
273
     * @return int
274
     */
275
    public function getCId()
276
    {
277
        return $this->cId;
278
    }
279
280
    /**
281
     * @return CThematicPlan[]|ArrayCollection
282
     */
283
    public function getPlans()
284
    {
285
        return $this->plans;
286
    }
287
288
    /**
289
     * @return CThematicAdvance[]|ArrayCollection
290
     */
291
    public function getAdvances()
292
    {
293
        return $this->advances;
294
    }
295
296
    public function __toString(): string
297
    {
298
        return $this->getTitle();
299
    }
300
301
    /**
302
     * Resource identifier.
303
     */
304
    public function getResourceIdentifier(): int
305
    {
306
        return $this->getIid();
307
    }
308
309
    public function getResourceName(): string
310
    {
311
        return $this->getTitle();
312
    }
313
}
314