Completed
Push — master ( 9fb967...b4d909 )
by Valentyn
03:32
created

ActorTranslations   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 58.33%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 1
dl 0
loc 88
ccs 14
cts 24
cp 0.5833
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setName() 0 4 1
A getPlaceOfBirth() 0 4 1
A setPlaceOfBirth() 0 4 1
A getLocale() 0 4 1
A __construct() 0 6 1
A getName() 0 4 1
A getBiography() 0 4 1
A setBiography() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Actors\Entity;
6
7
use App\Translation\EntityTranslationInterface;
8
use App\Translation\TranslatableTrait;
9
use Doctrine\ORM\Mapping as ORM;
10
use Symfony\Component\Serializer\Annotation\Groups;
11
12
/**
13
 * @ORM\Entity
14
 * @ORM\Table(name="actors_translations",
15
 *     uniqueConstraints={
16
 *      @ORM\UniqueConstraint(name="idx_ActorTranslations_locale_actor_id", columns={"locale", "actor_id"})
17
 *     })
18
 */
19
class ActorTranslations implements EntityTranslationInterface
20
{
21
    use TranslatableTrait;
22
23
    /**
24
     * @ORM\Id()
25
     * @ORM\GeneratedValue()
26
     * @ORM\Column(type="integer")
27
     */
28
    private $id;
29
30
    /**
31
     * @Groups({"list", "view"})
32
     * @ORM\Column(type="string", length=5)
33
     */
34
    private $locale;
35
36
    /**
37
     * @ORM\ManyToOne(targetEntity="App\Actors\Entity\Actor", inversedBy="translations")
38
     * @ORM\JoinColumn(nullable=false)
39
     */
40
    private $actor;
41
42
    /**
43
     * @Groups({"list", "view"})
44
     * @ORM\Column(type="string", length=100, nullable=false)
45
     */
46
    private $name;
47
48
    /**
49
     * @Groups({"list", "view"})
50
     * @ORM\Column(type="string", length=100, nullable=true)
51
     */
52
    private $placeOfBirth;
53
54
    /**
55
     * @Groups({"list", "view"})
56
     * @ORM\Column(type="text", nullable=true)
57
     */
58
    private $biography;
59
60 3
    public function getLocale(): string
61
    {
62 3
        return $this->locale;
63
    }
64
65 4
    public function __construct(Actor $actor, string $locale, string $name)
66
    {
67 4
        $this->actor = $actor;
68 4
        $this->locale = $locale;
69 4
        $this->name = $name;
70 4
    }
71
72
    public function getId()
73
    {
74
        return $this->id;
75
    }
76
77 3
    public function getName()
78
    {
79 3
        return $this->name;
80
    }
81
82
    public function setName(string $name): void
83
    {
84
        $this->name = $name;
85
    }
86
87
    public function getPlaceOfBirth()
88
    {
89
        return $this->placeOfBirth;
90
    }
91
92
    public function setPlaceOfBirth(string $placeOfBirth): void
93
    {
94
        $this->placeOfBirth = $placeOfBirth;
95
    }
96
97 3
    public function getBiography()
98
    {
99 3
        return $this->biography;
100
    }
101
102 4
    public function setBiography(string $biography): void
103
    {
104 4
        $this->biography = $biography;
105 4
    }
106
}
107