Passed
Push — master ( b95980...a81919 )
by Julito
08:46
created

CLinkCategory::getLinks()   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
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CourseBundle\Entity;
8
9
use Chamilo\CoreBundle\Entity\AbstractResource;
10
use Chamilo\CoreBundle\Entity\ResourceInterface;
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Doctrine\Common\Collections\Collection;
13
use Doctrine\ORM\Mapping as ORM;
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
/**
17
 * CLinkCategory.
18
 *
19
 * @ORM\Table(
20
 *  name="c_link_category",
21
 *  indexes={
22
 *  }
23
 * )
24
 * @ORM\Entity
25
 */
26
class CLinkCategory extends AbstractResource implements ResourceInterface
27
{
28
    /**
29
     * @ORM\Column(name="iid", type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue
32
     */
33
    protected int $iid;
34
35
    /**
36
     * @Assert\NotBlank()
37
     * @ORM\Column(name="category_title", type="string", length=255, nullable=false)
38
     */
39
    protected string $categoryTitle;
40
41
    /**
42
     * @ORM\Column(name="description", type="text", nullable=true)
43
     */
44
    protected ?string $description;
45
46
    /**
47
     * @ORM\Column(name="display_order", type="integer", nullable=false)
48
     */
49
    protected int $displayOrder;
50
51
    /**
52
     * @var Collection|CLink[]
53
     *
54
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLink", mappedBy="category")
55
     */
56
    protected $links;
57
58
    public function __construct()
59
    {
60
        $this->description = '';
61
        $this->displayOrder = 0;
62
        $this->links = new ArrayCollection();
63
    }
64
65
    public function __toString(): string
66
    {
67
        return $this->getCategoryTitle();
68
    }
69
70
    public function getIid(): int
71
    {
72
        return $this->iid;
73
    }
74
75
    public function setCategoryTitle(string $categoryTitle): self
76
    {
77
        $this->categoryTitle = $categoryTitle;
78
79
        return $this;
80
    }
81
82
    public function getCategoryTitle(): string
83
    {
84
        return $this->categoryTitle;
85
    }
86
87
    public function setDescription(string $description): self
88
    {
89
        $this->description = $description;
90
91
        return $this;
92
    }
93
94
    public function getDescription(): ?string
95
    {
96
        return $this->description;
97
    }
98
99
    public function setDisplayOrder(int $displayOrder): self
100
    {
101
        $this->displayOrder = $displayOrder;
102
103
        return $this;
104
    }
105
106
    public function getDisplayOrder(): int
107
    {
108
        return $this->displayOrder;
109
    }
110
111
    /**
112
     * @return CLink[]|Collection
113
     */
114
    public function getLinks()
115
    {
116
        return $this->links;
117
    }
118
119
    public function getResourceIdentifier(): int
120
    {
121
        return $this->iid;
122
    }
123
124
    public function getResourceName(): string
125
    {
126
        return $this->getCategoryTitle();
127
    }
128
129
    public function setResourceName(string $name): self
130
    {
131
        return $this->setCategoryTitle($name);
132
    }
133
}
134