1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace App\Movies\Entity; |
5
|
|
|
|
6
|
|
|
use App\Translation\EntityTranslationInterface; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
9
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @ORM\Entity |
13
|
|
|
* @ORM\Table(name="movies_translations", |
14
|
|
|
* uniqueConstraints={ |
15
|
|
|
* @ORM\UniqueConstraint(name="idx_MovieTranslations_locale_movie_id", columns={"locale", "movie_id"}) |
16
|
|
|
* }) |
17
|
|
|
*/ |
18
|
|
|
class MovieTranslations implements EntityTranslationInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @ORM\Id() |
22
|
|
|
* @ORM\GeneratedValue() |
23
|
|
|
* @ORM\Column(type="integer") |
24
|
|
|
*/ |
25
|
|
|
private $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @Groups({"list", "view"}) |
29
|
|
|
* @ORM\Column(type="string", length=5) |
30
|
|
|
*/ |
31
|
|
|
private $locale; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie", inversedBy="translations") |
35
|
|
|
* @ORM\JoinColumn(nullable=false) |
36
|
|
|
*/ |
37
|
|
|
private $movie; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @ORM\Column(type="string", length=100) |
41
|
|
|
* @Groups({"list", "view"}) |
42
|
|
|
*/ |
43
|
|
|
private $title; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\Column(type="string", length=255) |
47
|
|
|
* @Groups({"list", "view"}) |
48
|
|
|
*/ |
49
|
|
|
private $posterUrl; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @ORM\Column(type="text") |
53
|
|
|
* @Groups({"view"}) |
54
|
|
|
*/ |
55
|
|
|
private $overview; |
56
|
|
|
|
57
|
1 |
|
public function __construct(Movie $movie, string $locale, string $title, string $posterUrl, string $overview) |
58
|
|
|
{ |
59
|
1 |
|
$this->movie = $movie; |
60
|
1 |
|
$this->locale = $locale; |
61
|
1 |
|
$this->title = $title; |
62
|
1 |
|
$this->posterUrl = $posterUrl; |
63
|
1 |
|
$this->overview = $overview; |
64
|
1 |
|
} |
65
|
|
|
|
66
|
|
|
public function getId() |
67
|
|
|
{ |
68
|
|
|
return $this->id; |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
|
public function getTitle() |
72
|
|
|
{ |
73
|
2 |
|
return $this->title; |
74
|
|
|
} |
75
|
|
|
|
76
|
2 |
|
public function getLocale(): string |
77
|
|
|
{ |
78
|
2 |
|
return $this->locale; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
2 |
|
public function getPosterUrl() |
85
|
|
|
{ |
86
|
2 |
|
return $this->posterUrl; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return mixed |
91
|
|
|
*/ |
92
|
1 |
|
public function getOverview() |
93
|
|
|
{ |
94
|
1 |
|
return $this->overview; |
95
|
|
|
} |
96
|
|
|
} |