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