Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
90.91% |
20 / 22 |
|
86.67% |
13 / 15 |
CRAP | |
0.00% |
0 / 1 |
Review | |
90.91% |
20 / 22 |
|
86.67% |
13 / 15 |
15.17 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUsername | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setUsername | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getEmail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setEmail | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setContent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getRating | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setRating | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getReactions | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setReactions | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getWatchedAt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setWatchedAt | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getMovie | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setMovie | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace App\Entity; |
4 | |
5 | use App\Repository\ReviewRepository; |
6 | use Doctrine\ORM\Mapping as ORM; |
7 | use Symfony\Component\Validator\Constraints as Assert; |
8 | |
9 | /** |
10 | * @ORM\Entity(repositoryClass=ReviewRepository::class) |
11 | */ |
12 | class Review |
13 | { |
14 | /** |
15 | * @ORM\Id |
16 | * @ORM\GeneratedValue |
17 | * @ORM\Column(type="integer") |
18 | */ |
19 | private $id; |
20 | |
21 | /** |
22 | * @ORM\Column(type="string", length=50) |
23 | * @Assert\NotBlank |
24 | * ? https://symfony.com/doc/5.4/reference/constraints/Length.html |
25 | * @Assert\Length( |
26 | * min = 5, |
27 | * max = 50, |
28 | * minMessage = "Your username must be at least {{ limit }} characters long", |
29 | * maxMessage = "Your username cannot be longer than {{ limit }} characters" |
30 | * ) |
31 | */ |
32 | private $username; |
33 | |
34 | /** |
35 | * @ORM\Column(type="string", length=255) |
36 | * @Assert\NotBlank |
37 | * ? https://symfony.com/doc/5.4/reference/constraints/Email.html |
38 | * @Assert\Email( |
39 | * message = "The email '{{ value }}' is not a valid email." |
40 | * ) |
41 | */ |
42 | private $email; |
43 | |
44 | /** |
45 | * @ORM\Column(type="text") |
46 | * @Assert\NotBlank |
47 | * @Assert\Length( |
48 | * min = 3, |
49 | * max = 50, |
50 | * minMessage = "Votre critique doit contenir un minimum de {{ limit }} caractères. Soyez plus précis svp.", |
51 | * maxMessage = "Your first name cannot be longer than {{ limit }} characters" |
52 | * ) |
53 | */ |
54 | private $content; |
55 | |
56 | /** |
57 | * @ORM\Column(type="float") |
58 | * @Assert\NotBlank |
59 | */ |
60 | private $rating; |
61 | |
62 | /** |
63 | * Doctrine utilise le type json pour stocker une valeur avec une structure complexe |
64 | * dans notre cas un tableau |
65 | * @ORM\Column(type="json") |
66 | * @Assert\NotBlank |
67 | */ |
68 | private $reactions = []; |
69 | |
70 | /** |
71 | * @ORM\Column(type="datetime_immutable") |
72 | * @Assert\NotBlank |
73 | * ? https://symfony.com/doc/current/reference/constraints/Type.html |
74 | * @Assert\Type("\DateTimeInterface") |
75 | */ |
76 | private $watchedAt; |
77 | |
78 | /** |
79 | * @ORM\ManyToOne(targetEntity=Movie::class) |
80 | */ |
81 | private $movie; |
82 | |
83 | public function getId(): ?int |
84 | { |
85 | return $this->id; |
86 | } |
87 | |
88 | public function getUsername(): ?string |
89 | { |
90 | return $this->username; |
91 | } |
92 | |
93 | public function setUsername(string $username): self |
94 | { |
95 | $this->username = $username; |
96 | |
97 | return $this; |
98 | } |
99 | |
100 | public function getEmail(): ?string |
101 | { |
102 | return $this->email; |
103 | } |
104 | |
105 | public function setEmail(string $email): self |
106 | { |
107 | $this->email = $email; |
108 | |
109 | return $this; |
110 | } |
111 | |
112 | public function getContent(): ?string |
113 | { |
114 | return $this->content; |
115 | } |
116 | |
117 | public function setContent(string $content): self |
118 | { |
119 | $this->content = $content; |
120 | |
121 | return $this; |
122 | } |
123 | |
124 | public function getRating(): ?int |
125 | { |
126 | return $this->rating; |
127 | } |
128 | |
129 | public function setRating(int $rating): self |
130 | { |
131 | $this->rating = $rating; |
132 | |
133 | return $this; |
134 | } |
135 | |
136 | public function getReactions(): ?array |
137 | { |
138 | return $this->reactions; |
139 | } |
140 | |
141 | public function setReactions(array $reactions): self |
142 | { |
143 | $this->reactions = $reactions; |
144 | |
145 | return $this; |
146 | } |
147 | |
148 | public function getWatchedAt(): ?\DateTimeImmutable |
149 | { |
150 | return $this->watchedAt; |
151 | } |
152 | |
153 | public function setWatchedAt(?\DateTimeImmutable $watchedAt): self |
154 | { |
155 | $this->watchedAt = $watchedAt; |
156 | |
157 | return $this; |
158 | } |
159 | |
160 | public function getMovie(): ?Movie |
161 | { |
162 | return $this->movie; |
163 | } |
164 | |
165 | public function setMovie(?Movie $movie): self |
166 | { |
167 | $this->movie = $movie; |
168 | |
169 | return $this; |
170 | } |
171 | } |