Event::getDescriptionDe()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the vseth-semesterly-reports project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Entity;
13
14
use App\Entity\Base\BaseEntity;
15
use App\Entity\Traits\IdTrait;
16
use App\Entity\Traits\TimeTrait;
17
use App\Form\Type\SemesterType;
18
use Doctrine\ORM\Mapping as ORM;
19
20
/**
21
 * @ORM\Entity()
22
 * @ORM\HasLifecycleCallbacks
23
 */
24
class Event extends BaseEntity
25
{
26
    use IdTrait;
27
    use TimeTrait;
28
29
    /**
30
     * @var int
31
     *
32
     * @ORM\Column(type="integer")
33
     */
34
    private $semester;
35
36
    /**
37
     * @var string|null
38
     *
39
     * @ORM\Column(type="text", nullable=true)
40
     */
41
    private $nameDe;
42
43
    /**
44
     * @var string|null
45
     *
46
     * @ORM\Column(type="text", nullable=true)
47
     */
48
    private $nameEn;
49
50
    /**
51
     * @var string|null
52
     *
53
     * @ORM\Column(type="text", nullable=true)
54
     */
55
    private $descriptionDe;
56
57
    /**
58
     * @var string|null
59
     *
60
     * @ORM\Column(type="text", nullable=true)
61
     */
62
    private $descriptionEn;
63
64
    /**
65
     * @var string
66
     *
67
     * @ORM\Column(type="text")
68
     */
69
    private $location;
70
71
    /**
72
     * @var \DateTime|null
73
     *
74
     * @ORM\Column(type="datetime", nullable=true)
75
     */
76
    private $startDate;
77
78
    /**
79
     * @var \DateTime|null
80
     *
81
     * @ORM\Column(type="datetime", nullable=true)
82
     */
83
    private $endDate;
84
85
    /**
86
     * @var bool
87
     *
88
     * @ORM\Column(type="boolean", options={"default": true})
89
     */
90
    private $showInCalender = true;
91
92
    /**
93
     * @var int
94
     *
95
     * @ORM\Column(type="integer")
96
     */
97
    private $revenue = 0;
98
99
    /**
100
     * @var int
101
     *
102
     * @ORM\Column(type="integer")
103
     */
104
    private $expenditure = 0;
105
106
    /**
107
     * @var bool
108
     *
109
     * @ORM\Column(type="boolean")
110
     */
111
    private $needFinancialSupport = false;
112
113
    /**
114
     * @var Organisation
115
     *
116
     * @ORM\ManyToOne(targetEntity="App\Entity\Organisation", inversedBy="events")
117
     */
118
    private $organisation;
119
120
    public function getSemester(): int
121
    {
122
        return $this->semester;
123
    }
124
125
    /**
126
     * @return int
127
     */
128
    public function getSemesterName(): string
129
    {
130
        return SemesterType::semesterToString($this->getSemester());
0 ignored issues
show
Bug Best Practice introduced by
The expression return App\Form\Type\Sem...g($this->getSemester()) returns the type string which is incompatible with the documented return type integer.
Loading history...
131
    }
132
133
    public function setSemester(int $semester): void
134
    {
135
        $this->semester = $semester;
136
    }
137
138
    /**
139
     * @return string|null
140
     */
141
    public function getName($preference = 'de')
142
    {
143
        if ($preference === 'de') {
144
            return $this->getNameDe() !== null ? $this->getNameDe() : $this->getNameEn();
145
        }
146
147
        return $this->getNameEn() !== null ? $this->getNameEn() : $this->getNameDe();
148
    }
149
150
    public function getNameDe(): ?string
151
    {
152
        return $this->nameDe;
153
    }
154
155
    public function setNameDe(?string $nameDe): void
156
    {
157
        $this->nameDe = $nameDe;
158
    }
159
160
    public function getNameEn(): ?string
161
    {
162
        return $this->nameEn;
163
    }
164
165
    public function setNameEn(?string $nameEn): void
166
    {
167
        $this->nameEn = $nameEn;
168
    }
169
170
    /**
171
     * @return string|null
172
     */
173
    public function getDescription($preference = 'de')
174
    {
175
        if ($preference === 'de') {
176
            return $this->getDescriptionDe() !== null ? $this->getDescriptionDe() : $this->getDescriptionEn();
177
        }
178
179
        return $this->getDescriptionEn() !== null ? $this->getDescriptionEn() : $this->getDescriptionDe();
180
    }
181
182
    public function getDescriptionDe(): ?string
183
    {
184
        return $this->descriptionDe;
185
    }
186
187
    public function setDescriptionDe(?string $descriptionDe): void
188
    {
189
        $this->descriptionDe = $descriptionDe;
190
    }
191
192
    public function getDescriptionEn(): ?string
193
    {
194
        return $this->descriptionEn;
195
    }
196
197
    public function setDescriptionEn(?string $descriptionEn): void
198
    {
199
        $this->descriptionEn = $descriptionEn;
200
    }
201
202
    public function getLocation(): ?string
203
    {
204
        return $this->location;
205
    }
206
207
    public function setLocation(string $location): void
208
    {
209
        $this->location = $location;
210
    }
211
212
    public function getStartDate(): ?\DateTime
213
    {
214
        return $this->startDate;
215
    }
216
217
    public function setStartDate(?\DateTime $startDate): void
218
    {
219
        $this->startDate = $startDate;
220
    }
221
222
    public function getEndDate(): ?\DateTime
223
    {
224
        return $this->endDate;
225
    }
226
227
    public function setEndDate(?\DateTime $endDate): void
228
    {
229
        $this->endDate = $endDate;
230
    }
231
232
    public function getRevenue(): int
233
    {
234
        return $this->revenue;
235
    }
236
237
    public function setRevenue(int $revenue): void
238
    {
239
        $this->revenue = $revenue;
240
    }
241
242
    public function getExpenditure(): int
243
    {
244
        return $this->expenditure;
245
    }
246
247
    public function setExpenditure(int $expenditure): void
248
    {
249
        $this->expenditure = $expenditure;
250
    }
251
252
    public function isNeedFinancialSupport(): bool
253
    {
254
        return $this->needFinancialSupport;
255
    }
256
257
    public function setNeedFinancialSupport(bool $needFinancialSupport): void
258
    {
259
        $this->needFinancialSupport = $needFinancialSupport;
260
    }
261
262
    public function getOrganisation(): Organisation
263
    {
264
        return $this->organisation;
265
    }
266
267
    public function setOrganisation(Organisation $organisation): void
268
    {
269
        $this->organisation = $organisation;
270
    }
271
272
    public function getShowInCalender(): bool
273
    {
274
        return $this->showInCalender;
275
    }
276
277
    public function setShowInCalender(bool $showInCalender): void
278
    {
279
        $this->showInCalender = $showInCalender;
280
    }
281
}
282