Completed
Push — master ( f75b34...c65fe1 )
by Julito
11:42
created

CThematic::getPlans()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\AbstractResource;
8
use Chamilo\CoreBundle\Entity\ResourceInterface;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * CThematic.
15
 *
16
 * @ORM\Table(
17
 *  name="c_thematic",
18
 *  indexes={
19
 *      @ORM\Index(name="course", columns={"c_id"}),
20
 *      @ORM\Index(name="active", columns={"active", "session_id"})
21
 *  }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CThematic extends AbstractResource implements ResourceInterface
26
{
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(name="iid", type="integer")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     */
34
    protected $iid;
35
36
    /**
37
     * @var int
38
     *
39
     * @ORM\Column(name="c_id", type="integer")
40
     */
41
    protected $cId;
42
43
    /**
44
     * @var string
45
     * @Assert\NotBlank()
46
     * @ORM\Column(name="title", type="text", nullable=false)
47
     */
48
    protected $title;
49
50
    /**
51
     * @var string
52
     *
53
     * @ORM\Column(name="content", type="text", nullable=true)
54
     */
55
    protected $content;
56
57
    /**
58
     * @var int
59
     *
60
     * @ORM\Column(name="display_order", type="integer", nullable=false)
61
     */
62
    protected $displayOrder;
63
64
    /**
65
     * @var bool
66
     *
67
     * @ORM\Column(name="active", type="boolean", nullable=false)
68
     */
69
    protected $active;
70
71
    /**
72
     * @var int
73
     *
74
     * @ORM\Column(name="session_id", type="integer", nullable=false)
75
     */
76
    protected $sessionId;
77
78
    /**
79
     * @var CThematicPlan[]
80
     *
81
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CThematicPlan", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true)
82
     */
83
    protected $plans;
84
85
    /**
86
     * @var CThematicAdvance[]
87
     *
88
     * @ORM\OrderBy({"startDate" = "ASC"})
89
     *
90
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CThematicAdvance", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true)
91
     */
92
    protected $advances;
93
94
    public function __construct()
95
    {
96
        $this->id = 0;
97
        $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...
98
        $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...
99
    }
100
101
    public function __toString(): string
102
    {
103
        return $this->getTitle();
104
    }
105
106
    /**
107
     * Set title.
108
     *
109
     * @param string $title
110
     *
111
     * @return CThematic
112
     */
113
    public function setTitle($title)
114
    {
115
        $this->title = $title;
116
117
        return $this;
118
    }
119
120
    /**
121
     * Get title.
122
     *
123
     * @return string
124
     */
125
    public function getTitle()
126
    {
127
        return $this->title;
128
    }
129
130
    /**
131
     * Set content.
132
     *
133
     * @param string $content
134
     *
135
     * @return CThematic
136
     */
137
    public function setContent($content)
138
    {
139
        $this->content = $content;
140
141
        return $this;
142
    }
143
144
    /**
145
     * Get content.
146
     *
147
     * @return string
148
     */
149
    public function getContent()
150
    {
151
        return $this->content;
152
    }
153
154
    /**
155
     * Set displayOrder.
156
     *
157
     * @param int $displayOrder
158
     *
159
     * @return CThematic
160
     */
161
    public function setDisplayOrder($displayOrder)
162
    {
163
        $this->displayOrder = $displayOrder;
164
165
        return $this;
166
    }
167
168
    /**
169
     * Get displayOrder.
170
     *
171
     * @return int
172
     */
173
    public function getDisplayOrder()
174
    {
175
        return $this->displayOrder;
176
    }
177
178
    /**
179
     * Set active.
180
     *
181
     * @param bool $active
182
     *
183
     * @return CThematic
184
     */
185
    public function setActive($active)
186
    {
187
        $this->active = $active;
188
189
        return $this;
190
    }
191
192
    /**
193
     * Get active.
194
     *
195
     * @return bool
196
     */
197
    public function getActive()
198
    {
199
        return $this->active;
200
    }
201
202
    /**
203
     * Set sessionId.
204
     *
205
     * @param int $sessionId
206
     *
207
     * @return CThematic
208
     */
209
    public function setSessionId($sessionId)
210
    {
211
        $this->sessionId = $sessionId;
212
213
        return $this;
214
    }
215
216
    /**
217
     * Get sessionId.
218
     *
219
     * @return int
220
     */
221
    public function getSessionId()
222
    {
223
        return $this->sessionId;
224
    }
225
226
    /**
227
     * Set cId.
228
     *
229
     * @param int $cId
230
     *
231
     * @return CThematic
232
     */
233
    public function setCId($cId)
234
    {
235
        $this->cId = $cId;
236
237
        return $this;
238
    }
239
240
    public function getIid(): int
241
    {
242
        return $this->iid;
243
    }
244
245
    /**
246
     * Get cId.
247
     *
248
     * @return int
249
     */
250
    public function getCId()
251
    {
252
        return $this->cId;
253
    }
254
255
    /**
256
     * @return CThematicPlan[]|ArrayCollection
257
     */
258
    public function getPlans()
259
    {
260
        return $this->plans;
261
    }
262
263
    /**
264
     * @return CThematicAdvance[]|ArrayCollection
265
     */
266
    public function getAdvances()
267
    {
268
        return $this->advances;
269
    }
270
271
    /**
272
     * Resource identifier.
273
     */
274
    public function getResourceIdentifier(): int
275
    {
276
        return $this->getIid();
277
    }
278
279
    public function getResourceName(): string
280
    {
281
        return $this->getTitle();
282
    }
283
}
284