Passed
Pull Request — master (#26)
by Florian
02:07
created

Organisation::getLastVisitAt()   A

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\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
 * an event determines how the questionnaire looks like.
25
 *
26
 * @ORM\Entity(repositoryClass="App\Repository\OrganisationRepository")
27
 * @ORM\HasLifecycleCallbacks
28
 */
29
class Organisation extends BaseEntity
30
{
31
    use IdTrait;
32
    use TimeTrait;
33
    use HideTrait;
34
35
    /**
36
     * @var string
37
     *
38
     * @ORM\Column(type="text")
39
     */
40
    private $name;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(type="text")
46
     */
47
    private $email;
48
49
    /**
50
     * @var int
51
     *
52
     * @ORM\Column(type="integer")
53
     */
54
    private $relationSinceSemester;
55
56
    /**
57
     * @var string|null
58
     *
59
     * @ORM\Column(type="text", nullable=true)
60
     */
61
    private $comments;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(type="string")
67
     */
68
    private $authenticationCode;
69
70
    /**
71
     * @var DateTime|null
72
     *
73
     * @ORM\Column(type="datetime", nullable=true, options={"default": null})
74
     */
75
    private $lastVisitAt;
76
77
    /**
78
     * @var Event[]|ArrayCollection
79
     *
80
     * @ORM\OneToMany(targetEntity="Event", mappedBy="organisation")
81
     * @ORM\OrderBy({"semester" = "DESC", "startDate" = "DESC", "endDate" = "DESC"})
82
     */
83
    private $events;
84
85
    /**
86
     * @var SemesterReport[]|ArrayCollection
87
     *
88
     * @ORM\OneToMany(targetEntity="SemesterReport", mappedBy="organisation")
89
     * @ORM\OrderBy({"semester" = "DESC"})
90
     */
91
    private $semesterReports;
92
93
    public function __construct()
94
    {
95
        $this->events = new ArrayCollection();
96
        $this->semesterReports = new ArrayCollection();
97
    }
98
99
    public function getName(): string
100
    {
101
        return $this->name;
102
    }
103
104
    public function setName(string $name): void
105
    {
106
        $this->name = $name;
107
    }
108
109
    public function getEmail(): string
110
    {
111
        return $this->email;
112
    }
113
114
    public function setEmail(string $email): void
115
    {
116
        $this->email = $email;
117
    }
118
119
    public function getRelationSinceSemester(): int
120
    {
121
        return $this->relationSinceSemester;
122
    }
123
124
    public function setRelationSinceSemester(int $relationSinceSemester): void
125
    {
126
        $this->relationSinceSemester = $relationSinceSemester;
127
    }
128
129
    public function getAuthenticationCode(): string
130
    {
131
        return $this->authenticationCode;
132
    }
133
134
    public function getComments(): ?string
135
    {
136
        return $this->comments;
137
    }
138
139
    public function setComments(?string $comments): void
140
    {
141
        $this->comments = $comments;
142
    }
143
144
    /**
145
     * @throws \Exception
146
     */
147
    public function setAuthenticationCode(string $authenticationCode)
148
    {
149
        $this->authenticationCode = $authenticationCode;
150
    }
151
152
    /**
153
     * @throws \Exception
154
     */
155
    public function generateAuthenticationCode()
156
    {
157
        $this->authenticationCode = Uuid::uuid4();
0 ignored issues
show
Documentation Bug introduced by
It seems like Ramsey\Uuid\Uuid::uuid4() of type Ramsey\Uuid\UuidInterface is incompatible with the declared type string of property $authenticationCode.

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..

Loading history...
158
    }
159
160
    /**
161
     * @return Event[]|ArrayCollection
162
     */
163
    public function getEvents()
164
    {
165
        return $this->events;
166
    }
167
168
    /**
169
     * @return SemesterReport[]|ArrayCollection
170
     */
171
    public function getSemesterReports()
172
    {
173
        return $this->semesterReports;
174
    }
175
176
    public function setVisitOccurred()
177
    {
178
        $this->lastVisitAt = new \DateTime();
179
    }
180
181
    public function getLastVisitAt(): ?DateTime
182
    {
183
        return $this->lastVisitAt;
184
    }
185
}
186