Completed
Push — master ( 9dadb1...edd250 )
by Julito
12:09 queued 19s
created

CLink::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\ORM\Mapping as ORM;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
/**
13
 * CLink.
14
 *
15
 * @ORM\Table(name="c_link")
16
 * @ORM\Entity
17
 */
18
class CLink extends AbstractResource implements ResourceInterface
19
{
20
    /**
21
     * @var int
22
     *
23
     * @ORM\Column(name="iid", type="integer")
24
     * @ORM\Id
25
     * @ORM\GeneratedValue
26
     */
27
    protected $iid;
28
29
    /**
30
     * @var string
31
     * @Assert\NotBlank()
32
     * @ORM\Column(name="url", type="text", nullable=false)
33
     */
34
    protected $url;
35
36
    /**
37
     * @var string
38
     * @Assert\NotBlank()
39
     * @ORM\Column(name="title", type="string", length=150, nullable=true)
40
     */
41
    protected $title;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(name="description", type="text", nullable=true)
47
     */
48
    protected $description;
49
50
    /**
51
     * @var CLinkCategory|null
52
     *
53
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLinkCategory", inversedBy="links")
54
     * @ORM\JoinColumn(name="category_id", referencedColumnName="iid")
55
     */
56
    protected $category;
57
58
    /**
59
     * @var int
60
     *
61
     * @ORM\Column(name="display_order", type="integer", nullable=false)
62
     */
63
    protected $displayOrder;
64
65
    /**
66
     * @var string
67
     *
68
     * @ORM\Column(name="on_homepage", type="string", length=10, nullable=false)
69
     */
70
    protected $onHomepage;
71
72
    /**
73
     * @var string
74
     *
75
     * @ORM\Column(name="target", type="string", length=10, nullable=true)
76
     */
77
    protected $target;
78
79
    public function __construct()
80
    {
81
        $this->displayOrder = 0;
82
    }
83
84
    public function __toString(): string
85
    {
86
        return $this->getTitle();
87
    }
88
89
    /**
90
     * Set url.
91
     *
92
     * @param string $url
93
     *
94
     * @return CLink
95
     */
96
    public function setUrl($url)
97
    {
98
        $this->url = $url;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Get url.
105
     *
106
     * @return string
107
     */
108
    public function getUrl()
109
    {
110
        return $this->url;
111
    }
112
113
    /**
114
     * Set title.
115
     *
116
     * @param string $title
117
     *
118
     * @return CLink
119
     */
120
    public function setTitle($title)
121
    {
122
        $this->title = $title;
123
124
        return $this;
125
    }
126
127
    /**
128
     * Get title.
129
     *
130
     * @return string
131
     */
132
    public function getTitle()
133
    {
134
        return (string) $this->title;
135
    }
136
137
    /**
138
     * Set description.
139
     *
140
     * @param string $description
141
     *
142
     * @return CLink
143
     */
144
    public function setDescription($description)
145
    {
146
        $this->description = $description;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get description.
153
     *
154
     * @return string
155
     */
156
    public function getDescription()
157
    {
158
        return $this->description;
159
    }
160
161
    /**
162
     * Set displayOrder.
163
     *
164
     * @param int $displayOrder
165
     *
166
     * @return CLink
167
     */
168
    public function setDisplayOrder($displayOrder)
169
    {
170
        $this->displayOrder = $displayOrder;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get displayOrder.
177
     *
178
     * @return int
179
     */
180
    public function getDisplayOrder()
181
    {
182
        return $this->displayOrder;
183
    }
184
185
    /**
186
     * Set onHomepage.
187
     *
188
     * @param string $onHomepage
189
     *
190
     * @return CLink
191
     */
192
    public function setOnHomepage($onHomepage)
193
    {
194
        $this->onHomepage = $onHomepage;
195
196
        return $this;
197
    }
198
199
    /**
200
     * Get onHomepage.
201
     *
202
     * @return string
203
     */
204
    public function getOnHomepage()
205
    {
206
        return $this->onHomepage;
207
    }
208
209
    /**
210
     * Set target.
211
     *
212
     * @param string $target
213
     *
214
     * @return CLink
215
     */
216
    public function setTarget($target)
217
    {
218
        $this->target = $target;
219
220
        return $this;
221
    }
222
223
    /**
224
     * Get target.
225
     *
226
     * @return string
227
     */
228
    public function getTarget()
229
    {
230
        return $this->target;
231
    }
232
233
    public function getIid(): int
234
    {
235
        return $this->iid;
236
    }
237
238
    public function getCategory(): ?CLinkCategory
239
    {
240
        return $this->category;
241
    }
242
243
    public function setCategory(?CLinkCategory $category): self
244
    {
245
        $this->category = $category;
246
247
        return $this;
248
    }
249
250
    /**
251
     * Resource identifier.
252
     */
253
    public function getResourceIdentifier(): int
254
    {
255
        return $this->iid;
256
    }
257
258
    public function getResourceName(): string
259
    {
260
        return $this->getTitle();
261
    }
262
263
    public function setResourceName($name): self
264
    {
265
        return $this->setTitle($name);
266
    }
267
}
268