Completed
Pull Request — master (#21)
by Valentyn
01:42
created

Genre::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Entity;
5
6
use App\Entity\Translations\GenreTranslations;
7
use App\Translation\TranslatableTrait;
8
use App\Translation\TranslatableInterface;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
12
use JMS\Serializer\Annotation\ExclusionPolicy;
13
use JMS\Serializer\Annotation\Expose;
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
/**
17
 * @ORM\Entity(repositoryClass="App\Repository\GenreRepository")
18
 * @ORM\Table(name="genres")
19
 * @ExclusionPolicy("all")
20
 * @method GenreTranslations getTranslation(string $locale, bool $useFallbackLocale = true)
21
 */
22
class Genre implements TranslatableInterface
23
{
24
    use TranslatableTrait;
25
26
    /**
27
     * @ORM\Id()
28
     * @ORM\GeneratedValue()
29
     * @ORM\Column(type="integer")
30
     * @Expose
31
     */
32
    private $id;
33
34
    /**
35
     * @var $translations GenreTranslations[]|ArrayCollection
36
     * @ORM\OneToMany(targetEntity="App\Entity\Translations\GenreTranslations", mappedBy="genre", cascade={"persist", "remove"})
37
     * @Assert\Valid(traverse=true)
38
     */
39
    private $translations;
40
41 3
    public function __construct()
42
    {
43 3
        $this->translations = new ArrayCollection();
44 3
    }
45
46 1
    public function getId()
47
    {
48 1
        return $this->id;
49
    }
50
}