Completed
Push — master ( 058e40...9e132c )
by Valentyn
04:01
created

GenreTranslations::changeName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Genres\Entity;
6
7
use App\Translation\EntityTranslationInterface;
8
use Doctrine\ORM\Mapping as ORM;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * @ORM\Entity
13
 * @ORM\Table(name="genres_translations",
14
 *     uniqueConstraints={
15
 *      @ORM\UniqueConstraint(name="idx_GenreTranslations_locale_genre_id", columns={"locale", "genre_id"})
16
 *     })
17
 */
18
class GenreTranslations implements EntityTranslationInterface
19
{
20
    /**
21
     * @ORM\Id()
22
     * @ORM\GeneratedValue()
23
     * @ORM\Column(type="integer")
24
     */
25
    private $id;
26
27
    /**
28
     * @ORM\Column(type="string", length=5)
29
     * @Groups({"list", "view"})
30
     */
31
    private $locale;
32
33
    /**
34
     * @ORM\ManyToOne(targetEntity="App\Genres\Entity\Genre", inversedBy="translations")
35
     * @ORM\JoinColumn(nullable=false)
36
     */
37
    private $genre;
38
39
    /**
40
     * @Groups({"list", "view"})
41
     * @ORM\Column(type="string", length=50)
42
     */
43
    private $name;
44
45 2
    public function __construct(Genre $genre, string $locale, string $name)
46
    {
47 2
        $this->genre = $genre;
48 2
        $this->locale = $locale;
49 2
        $this->name = $name;
50 2
    }
51
52
    public function getId()
53
    {
54
        return $this->id;
55
    }
56
57 1
    public function changeName(string $name)
58
    {
59 1
        $this->name = $name;
60 1
    }
61
62 20
    public function getName()
63
    {
64 20
        return $this->name;
65
    }
66
67 20
    public function getLocale(): string
68
    {
69 20
        return $this->locale;
70
    }
71
}
72