|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* For licensing terms, see /license.txt */ |
|
4
|
|
|
|
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource; |
|
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
|
11
|
|
|
use Chamilo\CourseBundle\Repository\CForumCategoryRepository; |
|
12
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
13
|
|
|
use Doctrine\Common\Collections\Collection; |
|
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
15
|
|
|
use Stringable; |
|
16
|
|
|
use Symfony\Component\Uid\Uuid; |
|
17
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
18
|
|
|
|
|
19
|
|
|
#[ORM\Table(name: 'c_forum_category')] |
|
20
|
|
|
#[ORM\Entity(repositoryClass: CForumCategoryRepository::class)] |
|
21
|
|
|
class CForumCategory extends AbstractResource implements ResourceInterface, Stringable |
|
22
|
|
|
{ |
|
23
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
|
24
|
|
|
#[ORM\Id] |
|
25
|
|
|
#[ORM\GeneratedValue] |
|
26
|
|
|
protected ?int $iid = null; |
|
27
|
|
|
|
|
28
|
|
|
#[Assert\NotBlank] |
|
29
|
|
|
#[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] |
|
30
|
|
|
protected string $title; |
|
31
|
|
|
|
|
32
|
|
|
#[ORM\Column(name: 'cat_comment', type: 'text', nullable: true)] |
|
33
|
|
|
protected ?string $catComment; |
|
34
|
|
|
|
|
35
|
|
|
#[ORM\Column(name: 'locked', type: 'integer', nullable: false)] |
|
36
|
|
|
protected int $locked; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var Collection<int, CForum> |
|
40
|
|
|
*/ |
|
41
|
|
|
#[ORM\OneToMany(mappedBy: 'forumCategory', targetEntity: CForum::class)] |
|
42
|
|
|
protected Collection $forums; |
|
43
|
|
|
|
|
44
|
|
|
public function __construct() |
|
45
|
|
|
{ |
|
46
|
|
|
$this->catComment = ''; |
|
47
|
|
|
$this->locked = 0; |
|
48
|
|
|
$this->catOrder = 0; |
|
49
|
|
|
$this->forums = new ArrayCollection(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function __toString(): string |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->getTitle(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getIid(): ?int |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->iid; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function setTitle(string $title): self |
|
63
|
|
|
{ |
|
64
|
|
|
$this->title = $title; |
|
65
|
|
|
|
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Get title. |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getTitle(): string |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->title; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setCatComment(string $catComment): self |
|
78
|
|
|
{ |
|
79
|
|
|
$this->catComment = $catComment; |
|
80
|
|
|
|
|
81
|
|
|
return $this; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getCatComment(): ?string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->catComment; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setLocked(int $locked): self |
|
90
|
|
|
{ |
|
91
|
|
|
$this->locked = $locked; |
|
92
|
|
|
|
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getLocked(): int |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->locked; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @return Collection<int, CForum> |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getForums(): Collection |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->forums; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function getResourceIdentifier(): int|Uuid |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->getIid(); |
|
|
|
|
|
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function getResourceName(): string |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->getTitle(); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function setResourceName(string $name): self |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->setTitle($name); |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|