Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
72.22% |
13 / 18 |
|
68.75% |
11 / 16 |
CRAP | |
0.00% |
0 / 1 |
NotificationUser | |
72.22% |
13 / 18 |
|
68.75% |
11 / 16 |
21.49 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setMail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setToken | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getActive | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setActive | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNotification | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setNotification | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setSent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getReadAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setReadAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * This file is part of the MADIS - RGPD Management application. |
5 | * |
6 | * @copyright Copyright (c) 2018-2019 Soluris - Solutions Numériques Territoriales Innovantes |
7 | * |
8 | * This program is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU Affero General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU Affero General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Affero General Public License |
19 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | declare(strict_types=1); |
23 | |
24 | namespace App\Domain\Notification\Model; |
25 | |
26 | use App\Application\Traits\Model\HistoryTrait; |
27 | use App\Domain\User\Model\User; |
28 | use Doctrine\ORM\Mapping as ORM; |
29 | use Ramsey\Uuid\Uuid; |
30 | use Ramsey\Uuid\UuidInterface; |
31 | |
32 | /** |
33 | * @ORM\Entity |
34 | */ |
35 | class NotificationUser |
36 | { |
37 | use HistoryTrait; |
38 | |
39 | /** |
40 | * @ORM\Id() |
41 | * |
42 | * @ORM\Column(type="uuid") |
43 | * |
44 | * @var UuidInterface |
45 | */ |
46 | private $id; |
47 | |
48 | /** |
49 | * @ORM\Column(type="string", nullable=true) |
50 | */ |
51 | private ?string $mail; |
52 | |
53 | /** |
54 | * @ORM\ManyToOne(targetEntity="App\Domain\Notification\Model\Notification", inversedBy="notificationUsers") |
55 | * |
56 | * @ORM\JoinColumn(name="notification_id", referencedColumnName="id", onDelete="CASCADE") |
57 | */ |
58 | private Notification $notification; |
59 | |
60 | /** |
61 | * @ORM\ManyToOne(targetEntity="App\Domain\User\Model\User", inversedBy="notifications") |
62 | * |
63 | * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") |
64 | */ |
65 | private ?User $user; |
66 | |
67 | /** |
68 | * @ORM\Column(type="string", nullable=false) |
69 | */ |
70 | private ?string $token; |
71 | |
72 | /** |
73 | * @ORM\Column(type="boolean") |
74 | */ |
75 | private ?bool $active; |
76 | |
77 | /** |
78 | * @ORM\Column(type="datetime", name="read_at", nullable="true") |
79 | */ |
80 | private ?\DateTime $readAt = null; |
81 | |
82 | /** |
83 | * Has the email been sent for this notification and this user. |
84 | * |
85 | * @ORM\Column(type="boolean") |
86 | */ |
87 | private ?bool $sent; |
88 | |
89 | /** |
90 | * Category constructor. |
91 | * |
92 | * @throws \Exception |
93 | */ |
94 | public function __construct() |
95 | { |
96 | $this->id = Uuid::uuid4(); |
97 | $this->user = null; |
98 | $this->mail = null; |
99 | } |
100 | |
101 | public function getId(): UuidInterface |
102 | { |
103 | return $this->id; |
104 | } |
105 | |
106 | public function getMail(): ?string |
107 | { |
108 | return $this->mail; |
109 | } |
110 | |
111 | public function setMail(?string $mail): void |
112 | { |
113 | $this->mail = $mail; |
114 | } |
115 | |
116 | public function getToken(): ?string |
117 | { |
118 | return $this->token; |
119 | } |
120 | |
121 | public function setToken(?string $token): void |
122 | { |
123 | $this->token = $token; |
124 | } |
125 | |
126 | public function getActive(): ?bool |
127 | { |
128 | return $this->active; |
129 | } |
130 | |
131 | public function setActive(?bool $active): void |
132 | { |
133 | $this->active = $active; |
134 | } |
135 | |
136 | public function getNotification(): Notification |
137 | { |
138 | return $this->notification; |
139 | } |
140 | |
141 | public function setNotification(Notification $notification): void |
142 | { |
143 | $this->notification = $notification; |
144 | } |
145 | |
146 | public function getUser(): ?User |
147 | { |
148 | return $this->user; |
149 | } |
150 | |
151 | public function setUser(User $user): void |
152 | { |
153 | $this->user = $user; |
154 | } |
155 | |
156 | public function getSent(): ?bool |
157 | { |
158 | return $this->sent; |
159 | } |
160 | |
161 | public function setSent(?bool $sent): void |
162 | { |
163 | $this->sent = $sent; |
164 | } |
165 | |
166 | public function getReadAt(): ?\DateTime |
167 | { |
168 | return $this->readAt; |
169 | } |
170 | |
171 | public function setReadAt(?\DateTime $readAt): void |
172 | { |
173 | $this->readAt = $readAt; |
174 | } |
175 | } |