Passed
Push — master ( cb50ee...221dc3 )
by Julito
07:56
created

CThematic::getCId()   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\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="active", columns={"active"})
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
     * @Assert\NotBlank()
37
     *
38
     * @ORM\Column(name="title", type="text", nullable=false)
39
     */
40
    protected string $title;
41
42
    /**
43
     * @ORM\Column(name="content", type="text", nullable=true)
44
     */
45
    protected ?string $content;
46
47
    /**
48
     * @var int
49
     *
50
     * @ORM\Column(name="display_order", type="integer", nullable=false)
51
     */
52
    protected $displayOrder;
53
54
    /**
55
     * @var bool
56
     *
57
     * @ORM\Column(name="active", type="boolean", nullable=false)
58
     */
59
    protected $active;
60
61
    /**
62
     * @var CThematicPlan[]
63
     *
64
     * @ORM\OneToMany(
65
     *     targetEntity="CThematicPlan", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true
66
     * )
67
     */
68
    protected $plans;
69
70
    /**
71
     * @var CThematicAdvance[]
72
     *
73
     * @ORM\OrderBy({"startDate" = "ASC"})
74
     *
75
     * @ORM\OneToMany(
76
     *     targetEntity="CThematicAdvance", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true
77
     * )
78
     */
79
    protected $advances;
80
81
    public function __construct()
82
    {
83
        $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...
84
        $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...
85
    }
86
87
    public function __toString(): string
88
    {
89
        return $this->getTitle();
90
    }
91
92
    /**
93
     * Set title.
94
     *
95
     * @param string $title
96
     */
97
    public function setTitle($title): self
98
    {
99
        $this->title = $title;
100
101
        return $this;
102
    }
103
104
    /**
105
     * Get title.
106
     *
107
     * @return string
108
     */
109
    public function getTitle()
110
    {
111
        return $this->title;
112
    }
113
114
    /**
115
     * Set content.
116
     */
117
    public function setContent(string $content): self
118
    {
119
        $this->content = $content;
120
121
        return $this;
122
    }
123
124
    /**
125
     * Get content.
126
     */
127
    public function getContent(): ?string
128
    {
129
        return $this->content;
130
    }
131
132
    /**
133
     * Set displayOrder.
134
     *
135
     * @param int $displayOrder
136
     */
137
    public function setDisplayOrder($displayOrder): self
138
    {
139
        $this->displayOrder = $displayOrder;
140
141
        return $this;
142
    }
143
144
    /**
145
     * Get displayOrder.
146
     *
147
     * @return int
148
     */
149
    public function getDisplayOrder()
150
    {
151
        return $this->displayOrder;
152
    }
153
154
    /**
155
     * Set active.
156
     *
157
     * @param bool $active
158
     */
159
    public function setActive($active): self
160
    {
161
        $this->active = $active;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Get active.
168
     *
169
     * @return bool
170
     */
171
    public function getActive()
172
    {
173
        return $this->active;
174
    }
175
176
    public function getIid(): int
177
    {
178
        return $this->iid;
179
    }
180
181
    /**
182
     * @return CThematicPlan[]|ArrayCollection
183
     */
184
    public function getPlans()
185
    {
186
        return $this->plans;
187
    }
188
189
    /**
190
     * @return CThematicAdvance[]|ArrayCollection
191
     */
192
    public function getAdvances()
193
    {
194
        return $this->advances;
195
    }
196
197
    public function getResourceIdentifier(): int
198
    {
199
        return $this->getIid();
200
    }
201
202
    public function getResourceName(): string
203
    {
204
        return $this->getTitle();
205
    }
206
207
    public function setResourceName(string $name): self
208
    {
209
        return $this->setTitle($name);
210
    }
211
}
212