Passed
Push — master ( 784f8c...891151 )
by Julito
11:16
created

Promotion   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 137
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 28
dl 0
loc 137
rs 10
c 1
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A setDescription() 0 5 1
A getDescription() 0 3 1
A getCareer() 0 3 1
A setCareer() 0 5 1
A getId() 0 3 1
A __construct() 0 4 1
A setName() 0 5 1
A getName() 0 3 1
A getStatus() 0 3 1
A getSessions() 0 3 1
A setSessions() 0 5 1
A setStatus() 0 5 1
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
     * @Assert\NotBlank()
37
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
38
     */
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")
48
     * @ORM\JoinColumn(name="career_id", referencedColumnName="id")
49
     */
50
    protected Career $career;
51
52
    /**
53
     * @var Collection|Session[]
54
     *
55
     * @ORM\OneToMany(
56
     *     targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="promotion", cascade={"persist"}
57
     * )
58
     */
59
    protected Collection $sessions;
60
61
    /**
62
     * @ORM\Column(name="status", type="integer", nullable=false)
63
     */
64
    protected int $status;
65
66
    public function __construct()
67
    {
68
        $this->status = self::PROMOTION_STATUS_ACTIVE;
69
        $this->sessions = new ArrayCollection();
70
    }
71
72
    /**
73
     * Get id.
74
     *
75
     * @return int
76
     */
77
    public function getId()
78
    {
79
        return $this->id;
80
    }
81
82
    public function setName(string $name): self
83
    {
84
        $this->name = $name;
85
86
        return $this;
87
    }
88
89
    /**
90
     * Get name.
91
     *
92
     * @return string
93
     */
94
    public function getName()
95
    {
96
        return $this->name;
97
    }
98
99
    public function setDescription(string $description): self
100
    {
101
        $this->description = $description;
102
103
        return $this;
104
    }
105
106
    /**
107
     * Get description.
108
     *
109
     * @return string
110
     */
111
    public function getDescription()
112
    {
113
        return $this->description;
114
    }
115
116
    public function setCareer(Career $career): self
117
    {
118
        $this->career = $career;
119
120
        return $this;
121
    }
122
123
    public function getCareer(): Career
124
    {
125
        return $this->career;
126
    }
127
128
    public function setStatus(int $status): self
129
    {
130
        $this->status = $status;
131
132
        return $this;
133
    }
134
135
    /**
136
     * Get status.
137
     *
138
     * @return int
139
     */
140
    public function getStatus()
141
    {
142
        return $this->status;
143
    }
144
145
    /**
146
     * @return Session[]|Collection
147
     */
148
    public function getSessions()
149
    {
150
        return $this->sessions;
151
    }
152
153
    public function setSessions(Collection $sessions): self
154
    {
155
        $this->sessions = $sessions;
156
157
        return $this;
158
    }
159
}
160