Passed
Push — master ( ea0e05...21d25a )
by Julito
08:49
created

CForumCategory::setLocked()   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
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
 * CForumCategory.
18
 *
19
 * @ORM\Table(
20
 *     name="c_forum_category",
21
 *     indexes={
22
 *     }
23
 * )
24
 * @ORM\Entity
25
 */
26
class CForumCategory 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
     *
38
     * @ORM\Column(name="cat_title", type="string", length=255, nullable=false)
39
     */
40
    protected string $catTitle;
41
42
    /**
43
     * @ORM\Column(name="cat_comment", type="text", nullable=true)
44
     */
45
    protected ?string $catComment;
46
47
    /**
48
     * @ORM\Column(name="cat_order", type="integer", nullable=false)
49
     */
50
    protected int $catOrder;
51
52
    /**
53
     * @ORM\Column(name="locked", type="integer", nullable=false)
54
     */
55
    protected int $locked;
56
57
    /**
58
     * @var Collection|CForumForum[]
59
     *
60
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", mappedBy="forumCategory")
61
     */
62
    protected Collection $forums;
63
64
    public function __construct()
65
    {
66
        $this->catComment = '';
67
        $this->locked = 0;
68
        $this->forums = new ArrayCollection();
69
    }
70
71
    public function __toString(): string
72
    {
73
        return $this->getCatTitle();
74
    }
75
76
    /**
77
     * Get iid.
78
     *
79
     * @return int
80
     */
81
    public function getIid()
82
    {
83
        return $this->iid;
84
    }
85
86
    /**
87
     * Set catTitle.
88
     *
89
     * @return CForumCategory
90
     */
91
    public function setCatTitle(string $catTitle)
92
    {
93
        $this->catTitle = $catTitle;
94
95
        return $this;
96
    }
97
98
    /**
99
     * Get catTitle.
100
     *
101
     * @return string
102
     */
103
    public function getCatTitle()
104
    {
105
        return $this->catTitle;
106
    }
107
108
    public function setCatComment(string $catComment): self
109
    {
110
        $this->catComment = $catComment;
111
112
        return $this;
113
    }
114
115
    public function getCatComment(): ?string
116
    {
117
        return $this->catComment;
118
    }
119
120
    /**
121
     * Set catOrder.
122
     *
123
     * @return CForumCategory
124
     */
125
    public function setCatOrder(int $catOrder)
126
    {
127
        $this->catOrder = $catOrder;
128
129
        return $this;
130
    }
131
132
    /**
133
     * Get catOrder.
134
     *
135
     * @return int
136
     */
137
    public function getCatOrder()
138
    {
139
        return $this->catOrder;
140
    }
141
142
    /**
143
     * Set locked.
144
     *
145
     * @return CForumCategory
146
     */
147
    public function setLocked(int $locked)
148
    {
149
        $this->locked = $locked;
150
151
        return $this;
152
    }
153
154
    /**
155
     * Get locked.
156
     *
157
     * @return int
158
     */
159
    public function getLocked()
160
    {
161
        return $this->locked;
162
    }
163
164
    /**
165
     * Get forums.
166
     *
167
     * @return Collection|CForumForum[]
168
     */
169
    public function getForums()
170
    {
171
        return $this->forums;
172
    }
173
174
    public function getResourceIdentifier(): int
175
    {
176
        return $this->getIid();
177
    }
178
179
    public function getResourceName(): string
180
    {
181
        return $this->getCatTitle();
182
    }
183
184
    public function setResourceName(string $name): self
185
    {
186
        return $this->setCatTitle($name);
187
    }
188
}
189