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\HideTrait; |
16
|
|
|
use App\Entity\Traits\IdTrait; |
17
|
|
|
use App\Entity\Traits\TimeTrait; |
18
|
|
|
use DateTime; |
19
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
20
|
|
|
use Doctrine\ORM\Mapping as ORM; |
21
|
|
|
use Ramsey\Uuid\Uuid; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\OrganisationRepository") |
25
|
|
|
* @ORM\HasLifecycleCallbacks |
26
|
|
|
*/ |
27
|
|
|
class Organisation extends BaseEntity |
28
|
|
|
{ |
29
|
|
|
use IdTrait; |
30
|
|
|
use TimeTrait; |
31
|
|
|
use HideTrait; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(type="text") |
37
|
|
|
*/ |
38
|
|
|
private $name; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(type="text") |
44
|
|
|
*/ |
45
|
|
|
private $email; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var int |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(type="integer") |
51
|
|
|
*/ |
52
|
|
|
private $relationSinceSemester; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string|null |
56
|
|
|
* |
57
|
|
|
* @ORM\Column(type="text", nullable=true) |
58
|
|
|
*/ |
59
|
|
|
private $comments; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
* |
64
|
|
|
* @ORM\Column(type="string") |
65
|
|
|
*/ |
66
|
|
|
private $authenticationCode; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var DateTime|null |
70
|
|
|
* |
71
|
|
|
* @ORM\Column(type="datetime", nullable=true, options={"default": null}) |
72
|
|
|
*/ |
73
|
|
|
private $lastVisitAt; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var Event[]|ArrayCollection |
77
|
|
|
* |
78
|
|
|
* @ORM\OneToMany(targetEntity="Event", mappedBy="organisation") |
79
|
|
|
* @ORM\OrderBy({"semester" = "DESC", "startDate" = "DESC", "endDate" = "DESC"}) |
80
|
|
|
*/ |
81
|
|
|
private $events; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var SemesterReport[]|ArrayCollection |
85
|
|
|
* |
86
|
|
|
* @ORM\OneToMany(targetEntity="SemesterReport", mappedBy="organisation") |
87
|
|
|
* @ORM\OrderBy({"semester" = "DESC"}) |
88
|
|
|
*/ |
89
|
|
|
private $semesterReports; |
90
|
|
|
|
91
|
|
|
public function __construct() |
92
|
|
|
{ |
93
|
|
|
$this->events = new ArrayCollection(); |
94
|
|
|
$this->semesterReports = new ArrayCollection(); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getName(): string |
98
|
|
|
{ |
99
|
|
|
return $this->name; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function setName(string $name): void |
103
|
|
|
{ |
104
|
|
|
$this->name = $name; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function getEmail(): string |
108
|
|
|
{ |
109
|
|
|
return $this->email; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function setEmail(string $email): void |
113
|
|
|
{ |
114
|
|
|
$this->email = $email; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function getRelationSinceSemester(): int |
118
|
|
|
{ |
119
|
|
|
return $this->relationSinceSemester; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function setRelationSinceSemester(int $relationSinceSemester): void |
123
|
|
|
{ |
124
|
|
|
$this->relationSinceSemester = $relationSinceSemester; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function getAuthenticationCode(): string |
128
|
|
|
{ |
129
|
|
|
return $this->authenticationCode; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getComments(): ?string |
133
|
|
|
{ |
134
|
|
|
return $this->comments; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function setComments(?string $comments): void |
138
|
|
|
{ |
139
|
|
|
$this->comments = $comments; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @throws \Exception |
144
|
|
|
*/ |
145
|
|
|
public function generateAuthenticationCode() |
146
|
|
|
{ |
147
|
|
|
$this->authenticationCode = Uuid::uuid4(); |
|
|
|
|
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return Event[]|ArrayCollection |
152
|
|
|
*/ |
153
|
|
|
public function getEvents() |
154
|
|
|
{ |
155
|
|
|
return $this->events; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @return SemesterReport[]|ArrayCollection |
160
|
|
|
*/ |
161
|
|
|
public function getSemesterReports() |
162
|
|
|
{ |
163
|
|
|
return $this->semesterReports; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
public function setVisitOccurred() |
167
|
|
|
{ |
168
|
|
|
$this->lastVisitAt = new \DateTime(); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function getLastVisitAt(): ?DateTime |
172
|
|
|
{ |
173
|
|
|
return $this->lastVisitAt; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** @noinspection PhpUnused used by deserializer */ |
177
|
|
|
public function setAuthenticationCode(string $authenticationCode): void |
178
|
|
|
{ |
179
|
|
|
$this->authenticationCode = $authenticationCode; |
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..