1 | <?php |
||
15 | class WatchedMovie |
||
16 | { |
||
17 | /** |
||
18 | * @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie") |
||
19 | * @ORM\JoinColumn(nullable=false) |
||
20 | * @Groups({"list"}) |
||
21 | */ |
||
22 | protected $movie; |
||
23 | |||
24 | /** |
||
25 | * @Groups({"list", "view"}) |
||
26 | * @ORM\Column(type="decimal", nullable=true) |
||
27 | */ |
||
28 | protected $vote; |
||
29 | |||
30 | /** |
||
31 | * @Groups({"list", "view"}) |
||
32 | * @ORM\Column(type="datetime", nullable=false) |
||
33 | */ |
||
34 | protected $addedAt; |
||
35 | |||
36 | /** |
||
37 | * @Groups({"list", "view"}) |
||
38 | * @ORM\Column(type="date", nullable=true) |
||
39 | */ |
||
40 | protected $watchedAt; |
||
41 | |||
42 | /** |
||
43 | * WatchedMovie constructor. |
||
44 | * @param Movie $movie |
||
45 | * @param float|null $vote |
||
46 | * @param \DateTimeInterface|null $watchedAt |
||
47 | * @throws \Exception |
||
48 | */ |
||
49 | 6 | public function __construct(Movie $movie, ?float $vote, ?\DateTimeInterface $watchedAt) |
|
59 | |||
60 | public function updateMovie(Movie $movie) |
||
64 | |||
65 | 2 | public function getMovie(): ?Movie |
|
69 | |||
70 | 1 | public function getVote(): ?float |
|
71 | { |
||
72 | 1 | return (float)$this->vote; |
|
73 | } |
||
74 | |||
75 | public function getAddedAt(): ?\DateTimeInterface |
||
79 | |||
80 | 1 | public function getWatchedAt(): ?\DateTimeInterface |
|
84 | } |