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

CLink::setOnHomepage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
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\ORM\Mapping as ORM;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
/**
13
 * CLink.
14
 *
15
 * @ORM\Table(
16
 *  name="c_link",
17
 *  indexes={
18
 *      @ORM\Index(name="course", columns={"c_id"}),
19
 *      @ORM\Index(name="session_id", columns={"session_id"})
20
 *  }
21
 * )
22
 * @ORM\Entity
23
 */
24
class CLink 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 string
44
     * @Assert\NotBlank()
45
     * @ORM\Column(name="url", type="text", nullable=false)
46
     */
47
    protected $url;
48
49
    /**
50
     * @var string
51
     * @ORM\Column(name="title", type="string", length=150, nullable=true)
52
     */
53
    protected $title;
54
55
    /**
56
     * @var string
57
     *
58
     * @ORM\Column(name="description", type="text", nullable=true)
59
     */
60
    protected $description;
61
62
    /**
63
     * @var CLinkCategory|null
64
     *
65
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLinkCategory", inversedBy="links")
66
     * @ORM\JoinColumn(name="category_id", referencedColumnName="iid")
67
     */
68
    protected $category;
69
70
    /**
71
     * @var int
72
     *
73
     * @ORM\Column(name="display_order", type="integer", nullable=false)
74
     */
75
    protected $displayOrder;
76
77
    /**
78
     * @var string
79
     *
80
     * @ORM\Column(name="on_homepage", type="string", length=10, nullable=false)
81
     */
82
    protected $onHomepage;
83
84
    /**
85
     * @var string
86
     *
87
     * @ORM\Column(name="target", type="string", length=10, nullable=true)
88
     */
89
    protected $target;
90
91
    /**
92
     * @var int
93
     *
94
     * @ORM\Column(name="session_id", type="integer", nullable=true)
95
     */
96
    protected $sessionId;
97
98
    public function __construct()
99
    {
100
        $this->displayOrder = 0;
101
    }
102
103
    public function __toString(): string
104
    {
105
        return $this->getTitle();
106
    }
107
108
    /**
109
     * Set url.
110
     *
111
     * @param string $url
112
     *
113
     * @return CLink
114
     */
115
    public function setUrl($url)
116
    {
117
        $this->url = $url;
118
119
        return $this;
120
    }
121
122
    /**
123
     * Get url.
124
     *
125
     * @return string
126
     */
127
    public function getUrl()
128
    {
129
        return $this->url;
130
    }
131
132
    /**
133
     * Set title.
134
     *
135
     * @param string $title
136
     *
137
     * @return CLink
138
     */
139
    public function setTitle($title)
140
    {
141
        $this->title = $title;
142
143
        return $this;
144
    }
145
146
    /**
147
     * Get title.
148
     *
149
     * @return string
150
     */
151
    public function getTitle()
152
    {
153
        return (string) $this->title;
154
    }
155
156
    /**
157
     * Set description.
158
     *
159
     * @param string $description
160
     *
161
     * @return CLink
162
     */
163
    public function setDescription($description)
164
    {
165
        $this->description = $description;
166
167
        return $this;
168
    }
169
170
    /**
171
     * Get description.
172
     *
173
     * @return string
174
     */
175
    public function getDescription()
176
    {
177
        return $this->description;
178
    }
179
180
    /**
181
     * Set displayOrder.
182
     *
183
     * @param int $displayOrder
184
     *
185
     * @return CLink
186
     */
187
    public function setDisplayOrder($displayOrder)
188
    {
189
        $this->displayOrder = $displayOrder;
190
191
        return $this;
192
    }
193
194
    /**
195
     * Get displayOrder.
196
     *
197
     * @return int
198
     */
199
    public function getDisplayOrder()
200
    {
201
        return $this->displayOrder;
202
    }
203
204
    /**
205
     * Set onHomepage.
206
     *
207
     * @param string $onHomepage
208
     *
209
     * @return CLink
210
     */
211
    public function setOnHomepage($onHomepage)
212
    {
213
        $this->onHomepage = $onHomepage;
214
215
        return $this;
216
    }
217
218
    /**
219
     * Get onHomepage.
220
     *
221
     * @return string
222
     */
223
    public function getOnHomepage()
224
    {
225
        return $this->onHomepage;
226
    }
227
228
    /**
229
     * Set target.
230
     *
231
     * @param string $target
232
     *
233
     * @return CLink
234
     */
235
    public function setTarget($target)
236
    {
237
        $this->target = $target;
238
239
        return $this;
240
    }
241
242
    /**
243
     * Get target.
244
     *
245
     * @return string
246
     */
247
    public function getTarget()
248
    {
249
        return $this->target;
250
    }
251
252
    /**
253
     * Set sessionId.
254
     *
255
     * @param int $sessionId
256
     *
257
     * @return CLink
258
     */
259
    public function setSessionId($sessionId)
260
    {
261
        $this->sessionId = $sessionId;
262
263
        return $this;
264
    }
265
266
    /**
267
     * Get sessionId.
268
     *
269
     * @return int
270
     */
271
    public function getSessionId()
272
    {
273
        return $this->sessionId;
274
    }
275
276
    public function getIid(): int
277
    {
278
        return $this->iid;
279
    }
280
281
    /**
282
     * Set cId.
283
     *
284
     * @param int $cId
285
     *
286
     * @return CLink
287
     */
288
    public function setCId($cId)
289
    {
290
        $this->cId = $cId;
291
292
        return $this;
293
    }
294
295
    /**
296
     * Get cId.
297
     *
298
     * @return int
299
     */
300
    public function getCId()
301
    {
302
        return $this->cId;
303
    }
304
305
    public function getCategory(): ?CLinkCategory
306
    {
307
        return $this->category;
308
    }
309
310
    public function setCategory(?CLinkCategory $category): self
311
    {
312
        $this->category = $category;
313
314
        return $this;
315
    }
316
317
    /**
318
     * Resource identifier.
319
     */
320
    public function getResourceIdentifier(): int
321
    {
322
        return $this->iid;
323
    }
324
325
    public function getResourceName(): string
326
    {
327
        return $this->getTitle();
328
    }
329
330
    public function setResourceName($name): self
331
    {
332
        return $this->setTitle($name);
333
    }
334
}
335