Completed
Push — master ( db9c88...be5baf )
by Julito
14:58
created

CLinkCategory::setResourceName()   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 1
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
 * CLinkCategory.
15
 *
16
 * @ORM\Table(
17
 *  name="c_link_category",
18
 *  indexes={
19
 *      @ORM\Index(name="course", columns={"c_id"}),
20
 *      @ORM\Index(name="session_id", columns={"session_id"})
21
 *  }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CLinkCategory 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="category_title", type="string", length=255, nullable=false)
47
     */
48
    protected $categoryTitle;
49
50
    /**
51
     * @var string
52
     *
53
     * @ORM\Column(name="description", type="text", nullable=true)
54
     */
55
    protected $description;
56
57
    /**
58
     * @var int
59
     *
60
     * @ORM\Column(name="display_order", type="integer", nullable=false)
61
     */
62
    protected $displayOrder;
63
64
    /**
65
     * @var int
66
     *
67
     * @ORM\Column(name="session_id", type="integer", nullable=true)
68
     */
69
    protected $sessionId;
70
71
    /**
72
     * @var ArrayCollection|CLink[]
73
     *
74
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLink", mappedBy="category")
75
     */
76
    protected $links;
77
78
    public function __construct()
79
    {
80
    }
81
82
    public function __toString(): string
83
    {
84
        return $this->getCategoryTitle();
85
    }
86
87
    public function getIid(): int
88
    {
89
        return $this->iid;
90
    }
91
92
    /**
93
     * Set categoryTitle.
94
     *
95
     * @param string $categoryTitle
96
     *
97
     * @return CLinkCategory
98
     */
99
    public function setCategoryTitle($categoryTitle)
100
    {
101
        $this->categoryTitle = $categoryTitle;
102
103
        return $this;
104
    }
105
106
    /**
107
     * Get categoryTitle.
108
     *
109
     * @return string
110
     */
111
    public function getCategoryTitle()
112
    {
113
        return (string) $this->categoryTitle;
114
    }
115
116
    /**
117
     * Set description.
118
     *
119
     * @param string $description
120
     *
121
     * @return CLinkCategory
122
     */
123
    public function setDescription($description)
124
    {
125
        $this->description = $description;
126
127
        return $this;
128
    }
129
130
    /**
131
     * Get description.
132
     *
133
     * @return string
134
     */
135
    public function getDescription()
136
    {
137
        return $this->description;
138
    }
139
140
    /**
141
     * Set displayOrder.
142
     *
143
     * @param int $displayOrder
144
     *
145
     * @return CLinkCategory
146
     */
147
    public function setDisplayOrder($displayOrder)
148
    {
149
        $this->displayOrder = $displayOrder;
150
151
        return $this;
152
    }
153
154
    /**
155
     * Get displayOrder.
156
     *
157
     * @return int
158
     */
159
    public function getDisplayOrder()
160
    {
161
        return $this->displayOrder;
162
    }
163
164
    /**
165
     * Set sessionId.
166
     *
167
     * @param int $sessionId
168
     *
169
     * @return CLinkCategory
170
     */
171
    public function setSessionId($sessionId)
172
    {
173
        $this->sessionId = $sessionId;
174
175
        return $this;
176
    }
177
178
    /**
179
     * Get sessionId.
180
     *
181
     * @return int
182
     */
183
    public function getSessionId()
184
    {
185
        return $this->sessionId;
186
    }
187
188
    /**
189
     * Set cId.
190
     *
191
     * @param int $cId
192
     *
193
     * @return CLinkCategory
194
     */
195
    public function setCId($cId)
196
    {
197
        $this->cId = $cId;
198
199
        return $this;
200
    }
201
202
    /**
203
     * Get cId.
204
     *
205
     * @return int
206
     */
207
    public function getCId()
208
    {
209
        return $this->cId;
210
    }
211
212
    /**
213
     * Resource identifier.
214
     */
215
    public function getResourceIdentifier(): int
216
    {
217
        return $this->iid;
218
    }
219
220
    public function getResourceName(): string
221
    {
222
        return $this->getCategoryTitle();
223
    }
224
225
    public function setResourceName(string $name): self
226
    {
227
        return $this->setCategoryTitle($name);
228
    }
229
}
230