Completed
Push — master ( f446cd...59ed7d )
by Valentyn
13:46 queued 11:33
created

MovieTranslations::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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 5
    public function __construct(Movie $movie, MovieTranslationDTO $movieTranslationDTO)
59
    {
60 5
        $this->movie = $movie;
61 5
        $this->locale = $movieTranslationDTO->getLocale();
62 5
        $this->title = $movieTranslationDTO->getTitle();
63 5
        $this->posterUrl = $movieTranslationDTO->getPosterUrl();
64 5
        $this->overview = $movieTranslationDTO->getOverview();
65 5
    }
66
67
    public function getId()
68
    {
69
        return $this->id;
70
    }
71
72 11
    public function getTitle()
73
    {
74 11
        return $this->title;
75
    }
76
77 12
    public function getLocale(): string
78
    {
79 12
        return $this->locale;
80
    }
81
82
    /**
83
     * @return mixed
84
     */
85 11
    public function getPosterUrl()
86
    {
87 11
        return $this->posterUrl;
88
    }
89
90
    /**
91
     * @return mixed
92
     */
93 2
    public function getOverview()
94
    {
95 2
        return $this->overview;
96
    }
97
98
    /**
99
     * @param string $title
100
     */
101 1
    public function setTitle(string $title): void
102
    {
103 1
        $this->title = $title;
104 1
    }
105
106
    /**
107
     * @param string $overview
108
     */
109 1
    public function setOverview(string $overview): void
110
    {
111 1
        $this->overview = $overview;
112 1
    }
113
}
114