Passed
Push — main ( 2d8ac8...d23358 )
by Daniel
04:33
created

GenreMap   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 67
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getGenreTitle() 0 3 1
A setGenre() 0 4 1
A getGenreId() 0 3 1
A getGenre() 0 3 1
A setMappedItemId() 0 4 1
A getMappedItemId() 0 3 1
A getMappedItemType() 0 3 1
A setMappedItemType() 0 4 1
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 getGenreId(): int
45
    {
46
        return $this->genre->getId();
47
    }
48
49
    public function getMappedItemType(): GenreMapEnum
50
    {
51
        return $this->mapped_item_type;
52
    }
53
54
    public function setMappedItemType(GenreMapEnum $value): GenreMapInterface
55
    {
56
        $this->mapped_item_type = $value;
57
        return $this;
58
    }
59
60
    public function getMappedItemId(): int
61
    {
62
        return $this->mapped_item_id;
63
    }
64
65
    public function setMappedItemId(int $mapped_item_id): GenreMapInterface
66
    {
67
        $this->mapped_item_id = $mapped_item_id;
68
        return $this;
69
    }
70
71
    public function setGenre(GenreInterface $genre): GenreMapInterface
72
    {
73
        $this->genre = $genre;
74
        return $this;
75
    }
76
77
    public function getGenre(): GenreInterface
78
    {
79
        return $this->genre;
80
    }
81
}
82