1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace App\Movies\Entity; |
6
|
|
|
|
7
|
|
|
use App\Countries\Entity\Country; |
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
9
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @ORM\Entity(repositoryClass="App\Movies\Repository\MovieReleaseDateRepository") |
13
|
|
|
* @ORM\Table(name="movies_release_dates", |
14
|
|
|
* uniqueConstraints={ |
15
|
|
|
* @ORM\UniqueConstraint(name="Movie_id_Country_id", columns={"movie_id", "country_id"}) |
16
|
|
|
* }) |
17
|
|
|
*/ |
18
|
|
|
class MovieReleaseDate |
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\ManyToOne(targetEntity="App\Movies\Entity\Movie") |
30
|
|
|
* @ORM\JoinColumn(nullable=false) |
31
|
|
|
* @Groups({"list", "view"}) |
32
|
|
|
*/ |
33
|
|
|
private $movie; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @ORM\ManyToOne(targetEntity="App\Countries\Entity\Country") |
37
|
|
|
* @ORM\JoinColumn(nullable=false) |
38
|
|
|
* @Groups({"list", "view"}) |
39
|
|
|
*/ |
40
|
|
|
private $country; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @Groups({"list", "view"}) |
44
|
|
|
* @ORM\Column(type="date", nullable=true) |
45
|
|
|
*/ |
46
|
|
|
private $date; |
47
|
|
|
|
48
|
|
|
public function __construct(Movie $movie, Country $country, \DateTimeInterface $date) |
49
|
|
|
{ |
50
|
|
|
$this->movie = $movie; |
51
|
|
|
$this->country = $country; |
52
|
|
|
$this->date = $date; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function getId(): int |
56
|
|
|
{ |
57
|
|
|
return $this->id; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getMovie(): Movie |
61
|
|
|
{ |
62
|
|
|
return $this->movie; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getCountry(): Country |
66
|
|
|
{ |
67
|
|
|
return $this->country; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getDate(): \DateTimeInterface |
71
|
|
|
{ |
72
|
|
|
return $this->date; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|