|
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
|
|
|
* Career. |
|
17
|
|
|
*/ |
|
18
|
|
|
#[ORM\Table(name: 'career')] |
|
19
|
|
|
#[ORM\Entity] |
|
20
|
|
|
class Career |
|
21
|
|
|
{ |
|
22
|
|
|
use TimestampableEntity; |
|
23
|
|
|
|
|
24
|
|
|
public const CAREER_STATUS_ACTIVE = 1; |
|
25
|
|
|
public const CAREER_STATUS_INACTIVE = 0; |
|
26
|
|
|
|
|
27
|
|
|
#[ORM\Column(name: 'id', type: 'integer')] |
|
28
|
|
|
#[ORM\Id] |
|
29
|
|
|
#[ORM\GeneratedValue] |
|
30
|
|
|
protected ?int $id = null; |
|
31
|
|
|
|
|
32
|
|
|
#[Assert\NotBlank] |
|
33
|
|
|
#[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] |
|
34
|
|
|
protected string $title; |
|
35
|
|
|
|
|
36
|
|
|
#[ORM\Column(name: 'description', type: 'text', nullable: false)] |
|
37
|
|
|
protected ?string $description = null; |
|
38
|
|
|
|
|
39
|
|
|
#[ORM\Column(name: 'status', type: 'integer', nullable: false)] |
|
40
|
|
|
protected int $status; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var Collection|Promotion[] |
|
44
|
|
|
*/ |
|
45
|
|
|
#[ORM\OneToMany(targetEntity: Promotion::class, mappedBy: 'career', cascade: ['persist'])] |
|
46
|
|
|
protected Collection $promotions; |
|
47
|
|
|
|
|
48
|
|
|
public function __construct() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->status = self::CAREER_STATUS_ACTIVE; |
|
51
|
|
|
$this->promotions = new ArrayCollection(); |
|
52
|
|
|
$this->description = ''; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Get id. |
|
57
|
|
|
* |
|
58
|
|
|
* @return int |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getId() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->id; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function setTitle(string $title): self |
|
66
|
|
|
{ |
|
67
|
|
|
$this->title = $title; |
|
68
|
|
|
|
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getTitle(): string |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->title; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setDescription(string $description): self |
|
78
|
|
|
{ |
|
79
|
|
|
$this->description = $description; |
|
80
|
|
|
|
|
81
|
|
|
return $this; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getDescription(): ?string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->description; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setStatus(int $status): self |
|
90
|
|
|
{ |
|
91
|
|
|
$this->status = $status; |
|
92
|
|
|
|
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getStatus(): int |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->status; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function getPromotions(): array|ArrayCollection|Collection |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->promotions; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
public function setPromotions(Collection $promotions): self |
|
107
|
|
|
{ |
|
108
|
|
|
$this->promotions = $promotions; |
|
109
|
|
|
|
|
110
|
|
|
return $this; |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|