1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Movies\Entity; |
4
|
|
|
|
5
|
|
|
use App\Users\Entity\User; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @ORM\Entity(repositoryClass="App\Movies\Repository\MovieCardRepository") |
11
|
|
|
*/ |
12
|
|
|
class MovieCard |
13
|
|
|
{ |
14
|
|
|
public const TYPE_WATCH = 'watch'; |
15
|
|
|
public const TYPE_WATCH_FREE = 'watch_free'; |
16
|
|
|
public const TYPE_DOWNLOAD = 'download'; |
17
|
|
|
public const TYPE_REVIEW = 'review'; |
18
|
|
|
public const TYPE_TRAILER = 'trailer'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @ORM\Id() |
22
|
|
|
* @ORM\GeneratedValue() |
23
|
|
|
* @ORM\Column(type="integer") |
24
|
|
|
* @Groups({"list", "view"}) |
25
|
|
|
*/ |
26
|
|
|
private $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(type="string", length=255) |
30
|
|
|
* @Groups({"list", "view"}) |
31
|
|
|
*/ |
32
|
|
|
private $title; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @ORM\Column(type="string", length=255) |
36
|
|
|
* @Groups({"list", "view"}) |
37
|
|
|
*/ |
38
|
|
|
private $description; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @ORM\Column(type="string", length=255) |
42
|
|
|
* @Groups({"list", "view"}) |
43
|
|
|
*/ |
44
|
|
|
private $type; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ORM\Column(type="string", length=255) |
48
|
|
|
* @Groups({"list", "view"}) |
49
|
|
|
*/ |
50
|
|
|
private $url; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @ORM\Column(type="string", length=2) |
54
|
|
|
*/ |
55
|
|
|
private $locale; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie", inversedBy="cards") |
59
|
|
|
*/ |
60
|
|
|
private $movie; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @ORM\ManyToOne(targetEntity="App\Users\Entity\User") |
64
|
|
|
* @Groups({"list", "view"}) |
65
|
|
|
*/ |
66
|
|
|
private $user; |
67
|
|
|
|
68
|
1 |
|
public function __construct(Movie $movie, User $user, string $locale, string $title, string $description, string $type, string $url) |
69
|
|
|
{ |
70
|
1 |
|
$this->movie = $movie; |
71
|
1 |
|
$this->user = $user; |
72
|
1 |
|
$this->locale = $locale; |
73
|
1 |
|
$this->title = $title; |
74
|
1 |
|
$this->description = $description; |
75
|
1 |
|
$this->type = $type; |
76
|
1 |
|
$this->url = $url; |
77
|
1 |
|
} |
78
|
|
|
|
79
|
1 |
|
public function getId(): ?int |
80
|
|
|
{ |
81
|
1 |
|
return $this->id; |
82
|
|
|
} |
83
|
|
|
|
84
|
1 |
|
public function getTitle(): ?string |
85
|
|
|
{ |
86
|
1 |
|
return $this->title; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function setTitle(string $title): self |
90
|
|
|
{ |
91
|
|
|
$this->title = $title; |
92
|
|
|
|
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
1 |
|
public function getDescription(): ?string |
97
|
|
|
{ |
98
|
1 |
|
return $this->description; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function setDescription(string $description): self |
102
|
|
|
{ |
103
|
|
|
$this->description = $description; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
1 |
|
public function getType(): ?string |
109
|
|
|
{ |
110
|
1 |
|
return $this->type; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function setType(string $type): self |
114
|
|
|
{ |
115
|
|
|
$this->type = $type; |
116
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
1 |
|
public function getUrl(): ?string |
121
|
|
|
{ |
122
|
1 |
|
return $this->url; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function setUrl(string $url): self |
126
|
|
|
{ |
127
|
|
|
$this->url = $url; |
128
|
|
|
|
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getLocale() |
133
|
|
|
{ |
134
|
|
|
return $this->locale; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function setLocale($locale): void |
138
|
|
|
{ |
139
|
|
|
$this->locale = $locale; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function setMovie(Movie $movie): void |
143
|
|
|
{ |
144
|
|
|
$this->movie = $movie; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function setUser(User $user): void |
148
|
|
|
{ |
149
|
|
|
$this->user = $user; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function getMovie(): Movie |
153
|
|
|
{ |
154
|
|
|
return $this->movie; |
155
|
|
|
} |
156
|
|
|
|
157
|
1 |
|
public function getUser(): User |
158
|
|
|
{ |
159
|
1 |
|
return $this->user; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|