Passed
Push — develop ( cd614f...605826 )
by BENARD
04:36
created

Proof::setProofRequest()   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 1
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Entity;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Timestampable\Traits\TimestampableEntity;
8
use VideoGamesRecords\CoreBundle\ValueObject\ProofStatus;
9
10
/**
11
 * Proof
12
 * @ORM\Table(name="vgr_proof")
13
 * @ORM\Entity(repositoryClass="VideoGamesRecords\CoreBundle\Repository\ProofRepository")
14
 * @ORM\EntityListeners({"VideoGamesRecords\CoreBundle\EventListener\Entity\ProofListener"})
15
 */
16
class Proof
17
{
18
    use TimestampableEntity;
19
20
    /**
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="IDENTITY")
24
     */
25
    private ?int $id = null;
26
27
    /**
28
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Picture")
29
     * @ORM\JoinColumns({
30
     *   @ORM\JoinColumn(name="idPicture", referencedColumnName="id", nullable=true)
31
     * })
32
     */
33
    private ?Picture $picture = null;
34
35
    /**
36
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Video")
37
     * @ORM\JoinColumns({
38
     *   @ORM\JoinColumn(name="idVideo", referencedColumnName="id", nullable=true)
39
     * })
40
     */
41
    private ?Video $video = null;
42
43
     /**
44
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\ProofRequest")
45
     * @ORM\JoinColumns({
46
     *   @ORM\JoinColumn(name="idProofRequest", referencedColumnName="id", nullable=true)
47
     * })
48
     */
49
    private ?ProofRequest $proofRequest = null;
50
51
    /**
52
     * @ORM\Column(name="status", type="string", length=30, nullable=false)
53
     */
54
    private string $status = ProofStatus::STATUS_IN_PROGRESS;
55
56
    /**
57
     * @ORM\Column(name="response", type="text", nullable=true)
58
     */
59
    private ?string $response = null;
60
61
    /**
62
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Player")
63
     * @ORM\JoinColumns({
64
     *   @ORM\JoinColumn(name="idPlayerResponding", referencedColumnName="id", nullable=true)
65
     * })
66
     */
67
    private ?Player $playerResponding = null;
68
69
    /**
70
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Player")
71
     * @ORM\JoinColumns({
72
     *   @ORM\JoinColumn(name="idPlayer", referencedColumnName="id", nullable=false)
73
     * })
74
     */
75
    private Player $player;
76
77
    /**
78
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Chart", inversedBy="proofs")
79
     * @ORM\JoinColumns({
80
     *   @ORM\JoinColumn(name="idChart", referencedColumnName="id", nullable=false)
81
     * })
82
     */
83
    private Chart $chart;
84
85
    /**
86
     * @ORM\Column(name="checked_at", type="datetime", nullable=true)
87
     */
88
    private ?DateTime $checkedAt;
89
90
    /**
91
     * @ORM\OneToOne(targetEntity="\VideoGamesRecords\CoreBundle\Entity\PlayerChart", mappedBy="proof")
92
     */
93
    private ?PlayerChart $playerChart;
94
95
    public function __construct()
96
    {
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function __toString()
103
    {
104
        return sprintf('Proof [%s]', $this->id);
105
    }
106
107
108
    /**
109
     * Set id
110
     * @param integer $id
111
     * @return Proof
112
     */
113
    public function setId(int $id): Proof
114
    {
115
        $this->id = $id;
116
        return $this;
117
    }
118
119
    /**
120
     * Get id
121
     * @return integer
122
     */
123
    public function getId(): ?int
124
    {
125
        return $this->id;
126
    }
127
128
    /**
129
     * Set picture
130
     * @param Picture $picture
131
     * @return Proof
132
     */
133
    public function setPicture(Picture $picture): Proof
134
    {
135
        $this->picture = $picture;
136
        return $this;
137
    }
138
139
    /**
140
     * Get picture
141
     * @return Picture|null
142
     */
143
    public function getPicture(): ?Picture
144
    {
145
        return $this->picture;
146
    }
147
148
    /**
149
     * Set video
150
     * @param Video $video
151
     * @return Proof
152
     */
153
    public function setVideo(Video $video): Proof
154
    {
155
        $this->video = $video;
156
        return $this;
157
    }
158
159
    /**
160
     * Get video
161
     * @return Video|null
162
     */
163
    public function getVideo(): ?Video
164
    {
165
        return $this->video;
166
    }
167
168
    /**
169
     * @param ProofRequest $proofRequest
170
     * @return void
171
     */
172
    public function setProofRequest(ProofRequest $proofRequest): void
173
    {
174
        $this->proofRequest = $proofRequest;
175
    }
176
177
    /**
178
     * @return ProofRequest|null
179
     */
180
    public function getProofRequest(): ?ProofRequest
181
    {
182
        return $this->proofRequest;
183
    }
184
185
    /**
186
     * Set status
187
     * @param string $status
188
     * @return Proof
189
     */
190
    public function setStatus(string $status): Proof
191
    {
192
        $this->status = $status;
193
        return $this;
194
    }
195
196
    /**
197
     * Get status
198
     * @return ProofStatus
199
     */
200
    public function getStatus(): ProofStatus
201
    {
202
        return new ProofStatus($this->status);
203
    }
204
205
    /**
206
     * Set response
207
     * @param string $response
208
     * @return Proof
209
     */
210
    public function setResponse(string $response): Proof
211
    {
212
        $this->response = $response;
213
        return $this;
214
    }
215
216
    /**
217
     * Get response
218
     * @return string|null
219
     */
220
    public function getResponse(): ?string
221
    {
222
        return $this->response;
223
    }
224
225
    /**
226
     * Set playerResponding
227
     * @param Player|null $playerResponding
228
     * @return Proof
229
     */
230
    public function setPlayerResponding(Player $playerResponding = null): Proof
231
    {
232
        $this->playerResponding = $playerResponding;
233
234
        return $this;
235
    }
236
237
    /**
238
     * Get playerResponding
239
     * @return Player|null
240
     */
241
    public function getPlayerResponding(): ?Player
242
    {
243
        return $this->playerResponding;
244
    }
245
246
247
    /**
248
     * Set player
249
     * @param Player $player
250
     * @return Proof
251
     */
252
    public function setPlayer(Player $player): Proof
253
    {
254
        $this->player = $player;
255
256
        return $this;
257
    }
258
259
    /**
260
     * Get player
261
     * @return Player
262
     */
263
    public function getPlayer(): Player
264
    {
265
        return $this->player;
266
    }
267
268
    /**
269
     * Set chart
270
     * @param Chart $chart
271
     * @return Proof
272
     */
273
    public function setChart(Chart $chart): Proof
274
    {
275
        $this->chart = $chart;
276
277
        return $this;
278
    }
279
280
    /**
281
     * Get chart
282
     * @return Chart
283
     */
284
    public function getChart(): Chart
285
    {
286
        return $this->chart;
287
    }
288
289
    /**
290
     * Set checkedAt
291
     * @param DateTime $checkedAt
292
     * @return Proof
293
     */
294
    public function setCheckedAt(DateTime $checkedAt): Proof
295
    {
296
        $this->checkedAt = $checkedAt;
297
298
        return $this;
299
    }
300
301
    /**
302
     * Get checkedAt
303
     * @return DateTime
304
     */
305
    public function getCheckedAt(): ?DateTime
306
    {
307
        return $this->checkedAt;
308
    }
309
310
311
    /**
312
     * Get playerChart
313
     * @return PlayerChart
314
     */
315
    public function getPlayerChart(): ?PlayerChart
316
    {
317
        return $this->playerChart;
318
    }
319
320
    /**
321
     * @return string
322
     */
323
    public function getType(): string
324
    {
325
        return ($this->getPicture() != null) ? 'Picture' : 'Video';
326
    }
327
}
328