Passed
Push — main ( d7832a...2d8ac8 )
by Daniel
04:45
created

GenreMap::setGenre()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Model;
6
7
use Doctrine\DBAL\Types\Types;
8
use Doctrine\ORM\Mapping as ORM;
9
use Ramsey\Uuid\Doctrine\UuidGenerator;
10
use Ramsey\Uuid\Doctrine\UuidType;
11
use Uxmp\Core\Orm\Repository\GenreMapRepository;
12
13
#[ORM\Entity(repositoryClass: GenreMapRepository::class)]
14
#[ORM\Table(name: 'genre_map')]
15
class GenreMap implements GenreMapInterface
16
{
17
    #[ORM\Column(type: UuidType::NAME, unique: true)]
18
    #[ORM\Id, ORM\GeneratedValue(strategy: 'CUSTOM'), ORM\CustomIdGenerator(class: UuidGenerator::class)]
19
    private string $id;
20
21
    #[ORM\Column(type: Types::STRING, enumType: GenreMapEnum::class)]
22
    private GenreMapEnum $mapped_item_type;
0 ignored issues
show
Bug introduced by
The type Uxmp\Core\Orm\Model\GenreMapEnum was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
24
    #[ORM\Column(type: Types::INTEGER)]
25
    private int $mapped_item_id = 0;
26
27
    #[ORM\Column(type: Types::INTEGER)]
28
    private int $genre_id = 0;
0 ignored issues
show
introduced by
The private property $genre_id is not used, and could be removed.
Loading history...
29
30
    #[ORM\ManyToOne(targetEntity: Genre::class, inversedBy: 'mapped_genres')]
31
    #[ORM\JoinColumn(name: 'genre_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
32
    private GenreInterface $genre;
33
34
    public function getId(): string
35
    {
36
        return $this->id;
37
    }
38
39
    public function getGenreTitle(): string
40
    {
41
        return $this->genre->getTitle();
42
    }
43
44
    public function getMappedItemType(): GenreMapEnum
45
    {
46
        return $this->mapped_item_type;
47
    }
48
49
    public function setMappedItemType(GenreMapEnum $value): GenreMapInterface
50
    {
51
        $this->mapped_item_type = $value;
52
        return $this;
53
    }
54
55
    public function getMappedItemId(): int
56
    {
57
        return $this->mapped_item_id;
58
    }
59
60
    public function setMappedItemId(int $mapped_item_id): GenreMapInterface
61
    {
62
        $this->mapped_item_id = $mapped_item_id;
63
        return $this;
64
    }
65
66
    public function setGenre(GenreInterface $genre): GenreMapInterface
67
    {
68
        $this->genre = $genre;
69
        return $this;
70
    }
71
72
    public function getGenre(): GenreInterface
73
    {
74
        return $this->genre;
75
    }
76
}
77