Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
55.56% |
5 / 9 |
|
55.56% |
5 / 9 |
CRAP | |
0.00% |
0 / 1 |
Category | |
55.56% |
5 / 9 |
|
55.56% |
5 / 9 |
16.11 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSysteme | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSysteme | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDocuments | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setDocuments | |
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\Documentation\Model; |
25 | |
26 | use App\Application\Traits\Model\CreatorTrait; |
27 | use App\Application\Traits\Model\HistoryTrait; |
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 Category |
36 | { |
37 | use HistoryTrait; |
38 | use CreatorTrait; |
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") |
50 | * |
51 | * @var string|null |
52 | */ |
53 | private $name; |
54 | |
55 | /** |
56 | * @ORM\Column(type="boolean") |
57 | * |
58 | * @var bool|null |
59 | */ |
60 | private $systeme; |
61 | |
62 | /** |
63 | * @ORM\ManyToMany(targetEntity="Document", mappedBy="categories") |
64 | * |
65 | * @ORM\JoinTable(name="document_categories", |
66 | * joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id", onDelete="cascade")}, |
67 | * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="cascade")} |
68 | * ) |
69 | * |
70 | * @var array|null |
71 | */ |
72 | private $documents; |
73 | |
74 | /** |
75 | * Category constructor. |
76 | * |
77 | * @throws \Exception |
78 | */ |
79 | public function __construct() |
80 | { |
81 | $this->id = Uuid::uuid4(); |
82 | } |
83 | |
84 | public function __toString() |
85 | { |
86 | return $this->getName(); |
87 | } |
88 | |
89 | public function getId(): UuidInterface |
90 | { |
91 | return $this->id; |
92 | } |
93 | |
94 | public function getName(): ?string |
95 | { |
96 | return $this->name; |
97 | } |
98 | |
99 | public function setName(?string $name): void |
100 | { |
101 | $this->name = $name; |
102 | } |
103 | |
104 | public function getSysteme(): ?bool |
105 | { |
106 | return $this->systeme; |
107 | } |
108 | |
109 | public function setSysteme(?bool $systeme): void |
110 | { |
111 | $this->systeme = $systeme; |
112 | } |
113 | |
114 | public function getDocuments(): ?iterable |
115 | { |
116 | return $this->documents; |
117 | } |
118 | |
119 | public function setDocuments(?array $documents): void |
120 | { |
121 | $this->documents = $documents; |
122 | } |
123 | } |