1 | <?php |
||
14 | class MovieReview |
||
15 | { |
||
16 | /** |
||
17 | * Important note here - this property (userWatchedMovie) MUST be first, |
||
18 | * because otherwise Doctrine will fill (override) user_id and movie_id with values from UserWatchedMovie |
||
19 | * which usually just nulls. |
||
20 | * |
||
21 | * @ORM\OneToOne(targetEntity="App\Users\Entity\UserWatchedMovie") |
||
22 | * @ORM\JoinColumns({ |
||
23 | * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id"), |
||
24 | * @ORM\JoinColumn(name="movie_id", referencedColumnName="movie_id") |
||
25 | * }) |
||
26 | * @Groups({"list", "view"}) |
||
27 | */ |
||
28 | private $userWatchedMovie; |
||
29 | |||
30 | /** |
||
31 | * @ORM\Id() |
||
32 | * @ORM\GeneratedValue() |
||
33 | * @ORM\Column(type="integer") |
||
34 | * @Groups({"list", "view"}) |
||
35 | */ |
||
36 | private $id; |
||
37 | |||
38 | /** |
||
39 | * @ORM\Column(type="text") |
||
40 | * @Groups({"list", "view"}) |
||
41 | */ |
||
42 | private $text; |
||
43 | |||
44 | /** |
||
45 | * @ORM\Column(type="string", length=2) |
||
46 | */ |
||
47 | private $locale; |
||
48 | |||
49 | /** |
||
50 | * @ORM\Column(type="boolean") |
||
51 | */ |
||
52 | private $isReview; |
||
53 | |||
54 | /** |
||
55 | * @ORM\ManyToOne(targetEntity="MovieReview") |
||
56 | */ |
||
57 | private $answerTo; |
||
58 | |||
59 | /** |
||
60 | * @ORM\OneToMany(targetEntity="MovieReview", mappedBy="answerTo", cascade={"persist"}) |
||
61 | */ |
||
62 | private $answers; |
||
63 | |||
64 | /** |
||
65 | * @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie") |
||
66 | */ |
||
67 | private $movie; |
||
68 | |||
69 | /** |
||
70 | * @ORM\ManyToOne(targetEntity="App\Users\Entity\User") |
||
71 | * @Groups({"list", "view"}) |
||
72 | */ |
||
73 | private $user; |
||
74 | |||
75 | 1 | public function __construct(Movie $movie, User $user, string $locale, string $text) |
|
84 | |||
85 | 1 | public function getId() |
|
89 | |||
90 | public function setText($text): void |
||
94 | |||
95 | 1 | public function getText() |
|
99 | |||
100 | public function getLocale() |
||
104 | |||
105 | public function setLocale($locale): void |
||
109 | |||
110 | public function setMovie(Movie $movie): void |
||
114 | |||
115 | public function setUser(User $user): void |
||
119 | |||
120 | public function getMovie(): Movie |
||
124 | |||
125 | 1 | public function getUser(): User |
|
129 | |||
130 | public function getAnswers() |
||
134 | |||
135 | public function setAnswerTo(MovieReview $movieReview) |
||
140 | |||
141 | 1 | public function getUserWatchedMovie() |
|
145 | } |
||
146 |