Completed
Push — master ( 76b5db...d28136 )
by Julito
13:35
created

CLink::setUrl()   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
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Entity;
5
6
use APY\DataGridBundle\Grid\Mapping as GRID;
7
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CLink.
13
 *
14
 * @ORM\Table(
15
 *  name="c_link",
16
 *  indexes={
17
 *      @ORM\Index(name="course", columns={"c_id"}),
18
 *      @ORM\Index(name="session_id", columns={"session_id"})
19
 *  }
20
 * )
21
 * @ORM\Entity
22
 * @GRID\Source(columns="iid, title, resourceNode.createdAt", filterable=false)
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 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="url", type="text", nullable=false)
53
     */
54
    protected $url;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="title", type="string", length=150, nullable=true)
60
     */
61
    protected $title;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(name="description", type="text", nullable=true)
67
     */
68
    protected $description;
69
70
    /**
71
     * @var int
72
     *
73
     * @ORM\Column(name="category_id", type="integer", nullable=true)
74
     */
75
    protected $categoryId;
76
77
    /**
78
     * @var int
79
     *
80
     * @ORM\Column(name="display_order", type="integer", nullable=false)
81
     */
82
    protected $displayOrder;
83
84
    /**
85
     * @var string
86
     *
87
     * @ORM\Column(name="on_homepage", type="string", length=10, nullable=false)
88
     */
89
    protected $onHomepage;
90
91
    /**
92
     * @var string
93
     *
94
     * @ORM\Column(name="target", type="string", length=10, nullable=true)
95
     */
96
    protected $target;
97
98
    /**
99
     * @var int
100
     *
101
     * @ORM\Column(name="session_id", type="integer", nullable=true)
102
     */
103
    protected $sessionId;
104
105
    /**
106
     * Set url.
107
     *
108
     * @param string $url
109
     *
110
     * @return CLink
111
     */
112
    public function setUrl($url)
113
    {
114
        $this->url = $url;
115
116
        return $this;
117
    }
118
119
    /**
120
     * Get url.
121
     *
122
     * @return string
123
     */
124
    public function getUrl()
125
    {
126
        return $this->url;
127
    }
128
129
    /**
130
     * Set title.
131
     *
132
     * @param string $title
133
     *
134
     * @return CLink
135
     */
136
    public function setTitle($title)
137
    {
138
        $this->title = $title;
139
140
        return $this;
141
    }
142
143
    /**
144
     * Get title.
145
     *
146
     * @return string
147
     */
148
    public function getTitle()
149
    {
150
        return (string) $this->title;
151
    }
152
153
    /**
154
     * Set description.
155
     *
156
     * @param string $description
157
     *
158
     * @return CLink
159
     */
160
    public function setDescription($description)
161
    {
162
        $this->description = $description;
163
164
        return $this;
165
    }
166
167
    /**
168
     * Get description.
169
     *
170
     * @return string
171
     */
172
    public function getDescription()
173
    {
174
        return $this->description;
175
    }
176
177
    /**
178
     * Set categoryId.
179
     *
180
     * @param int $categoryId
181
     *
182
     * @return CLink
183
     */
184
    public function setCategoryId($categoryId)
185
    {
186
        $this->categoryId = $categoryId;
187
188
        return $this;
189
    }
190
191
    /**
192
     * Get categoryId.
193
     *
194
     * @return int
195
     */
196
    public function getCategoryId()
197
    {
198
        return $this->categoryId;
199
    }
200
201
    /**
202
     * Set displayOrder.
203
     *
204
     * @param int $displayOrder
205
     *
206
     * @return CLink
207
     */
208
    public function setDisplayOrder($displayOrder)
209
    {
210
        $this->displayOrder = $displayOrder;
211
212
        return $this;
213
    }
214
215
    /**
216
     * Get displayOrder.
217
     *
218
     * @return int
219
     */
220
    public function getDisplayOrder()
221
    {
222
        return $this->displayOrder;
223
    }
224
225
    /**
226
     * Set onHomepage.
227
     *
228
     * @param string $onHomepage
229
     *
230
     * @return CLink
231
     */
232
    public function setOnHomepage($onHomepage)
233
    {
234
        $this->onHomepage = $onHomepage;
235
236
        return $this;
237
    }
238
239
    /**
240
     * Get onHomepage.
241
     *
242
     * @return string
243
     */
244
    public function getOnHomepage()
245
    {
246
        return $this->onHomepage;
247
    }
248
249
    /**
250
     * Set target.
251
     *
252
     * @param string $target
253
     *
254
     * @return CLink
255
     */
256
    public function setTarget($target)
257
    {
258
        $this->target = $target;
259
260
        return $this;
261
    }
262
263
    /**
264
     * Get target.
265
     *
266
     * @return string
267
     */
268
    public function getTarget()
269
    {
270
        return $this->target;
271
    }
272
273
    /**
274
     * Set sessionId.
275
     *
276
     * @param int $sessionId
277
     *
278
     * @return CLink
279
     */
280
    public function setSessionId($sessionId)
281
    {
282
        $this->sessionId = $sessionId;
283
284
        return $this;
285
    }
286
287
    /**
288
     * Get sessionId.
289
     *
290
     * @return int
291
     */
292
    public function getSessionId()
293
    {
294
        return $this->sessionId;
295
    }
296
297
    /**
298
     * Set id.
299
     *
300
     * @param int $id
301
     *
302
     * @return CLink
303
     */
304
    public function setId($id)
305
    {
306
        $this->id = $id;
307
308
        return $this;
309
    }
310
311
    /**
312
     * Get id.
313
     *
314
     * @return int
315
     */
316
    public function getId()
317
    {
318
        return $this->id;
319
    }
320
321
    /**
322
     * Set cId.
323
     *
324
     * @param int $cId
325
     *
326
     * @return CLink
327
     */
328
    public function setCId($cId)
329
    {
330
        $this->cId = $cId;
331
332
        return $this;
333
    }
334
335
    /**
336
     * Get cId.
337
     *
338
     * @return int
339
     */
340
    public function getCId()
341
    {
342
        return $this->cId;
343
    }
344
345
    /**
346
     * Resource identifier.
347
     */
348
    public function getResourceIdentifier(): int
349
    {
350
        return $this->iid;
351
    }
352
353
    public function getResourceName(): string
354
    {
355
        return $this->getTitle();
356
    }
357
358
    public function getResourceFieldName(): string
359
    {
360
        return 'title';
361
    }
362
363
    public function __toString(): string
364
    {
365
        return $this->getTitle();
366
    }
367
}
368