1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
10
|
|
|
use Doctrine\Common\Collections\Collection; |
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
12
|
|
|
use Gedmo\Timestampable\Traits\TimestampableEntity; |
13
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Promotion. |
17
|
|
|
* |
18
|
|
|
* @ORM\Table(name="promotion") |
19
|
|
|
* @ORM\Entity |
20
|
|
|
*/ |
21
|
|
|
class Promotion |
22
|
|
|
{ |
23
|
|
|
use TimestampableEntity; |
24
|
|
|
|
25
|
|
|
public const PROMOTION_STATUS_ACTIVE = 1; |
26
|
|
|
public const PROMOTION_STATUS_INACTIVE = 0; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(name="id", type="integer") |
30
|
|
|
* @ORM\Id |
31
|
|
|
* @ORM\GeneratedValue() |
32
|
|
|
*/ |
33
|
|
|
protected int $id; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @ORM\Column(name="name", type="string", length=255, nullable=false) |
37
|
|
|
*/ |
38
|
|
|
#[Assert\NotBlank] |
39
|
|
|
protected string $name; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @ORM\Column(name="description", type="text", nullable=false) |
43
|
|
|
*/ |
44
|
|
|
protected ?string $description = null; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Career", inversedBy="promotions") |
48
|
|
|
* @ORM\JoinColumn(name="career_id", referencedColumnName="id") |
49
|
|
|
*/ |
50
|
|
|
protected Career $career; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var Collection|Session[] |
54
|
|
|
* |
55
|
|
|
* @ORM\OneToMany(targetEntity="Session", mappedBy="promotion", cascade={"persist"}) |
56
|
|
|
*/ |
57
|
|
|
protected Collection $sessions; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var Collection|SysAnnouncement[] |
61
|
|
|
* |
62
|
|
|
* @ORM\OneToMany(targetEntity="SysAnnouncement", mappedBy="promotion", cascade={"persist"}) |
63
|
|
|
*/ |
64
|
|
|
protected Collection $announcements; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @ORM\Column(name="status", type="integer", nullable=false) |
68
|
|
|
*/ |
69
|
|
|
protected int $status; |
70
|
|
|
|
71
|
|
|
public function __construct() |
72
|
|
|
{ |
73
|
|
|
$this->status = self::PROMOTION_STATUS_ACTIVE; |
74
|
|
|
$this->announcements = new ArrayCollection(); |
75
|
|
|
$this->sessions = new ArrayCollection(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get id. |
80
|
|
|
* |
81
|
|
|
* @return int |
82
|
|
|
*/ |
83
|
|
|
public function getId() |
84
|
|
|
{ |
85
|
|
|
return $this->id; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function setName(string $name): self |
89
|
|
|
{ |
90
|
|
|
$this->name = $name; |
91
|
|
|
|
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function getName(): string |
96
|
|
|
{ |
97
|
|
|
return $this->name; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function setDescription(string $description): self |
101
|
|
|
{ |
102
|
|
|
$this->description = $description; |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Get description. |
109
|
|
|
* |
110
|
|
|
* @return string |
111
|
|
|
*/ |
112
|
|
|
public function getDescription() |
113
|
|
|
{ |
114
|
|
|
return $this->description; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function setCareer(Career $career): self |
118
|
|
|
{ |
119
|
|
|
$this->career = $career; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getCareer(): Career |
125
|
|
|
{ |
126
|
|
|
return $this->career; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function setStatus(int $status): self |
130
|
|
|
{ |
131
|
|
|
$this->status = $status; |
132
|
|
|
|
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get status. |
138
|
|
|
* |
139
|
|
|
* @return int |
140
|
|
|
*/ |
141
|
|
|
public function getStatus() |
142
|
|
|
{ |
143
|
|
|
return $this->status; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return Session[]|Collection |
148
|
|
|
*/ |
149
|
|
|
public function getSessions() |
150
|
|
|
{ |
151
|
|
|
return $this->sessions; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setSessions(Collection $sessions): self |
155
|
|
|
{ |
156
|
|
|
$this->sessions = $sessions; |
157
|
|
|
|
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return SysAnnouncement[]|Collection |
163
|
|
|
*/ |
164
|
|
|
public function getAnnouncements() |
165
|
|
|
{ |
166
|
|
|
return $this->announcements; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param SysAnnouncement[]|Collection $announcements |
171
|
|
|
*/ |
172
|
|
|
public function setAnnouncements($announcements): self |
173
|
|
|
{ |
174
|
|
|
$this->announcements = $announcements; |
175
|
|
|
|
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|