Completed
Push — master ( 5e4ebc...f96e76 )
by Florian
13s queued 11s
created

Organisation::ensureFutureEventsPopulated()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 12
rs 10
cc 4
nc 4
nop 0

1 Method

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