|
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; |
|
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; |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
#[ORM\ManyToOne(targetEntity: GenreInterface::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
|
1 |
|
public function getGenreTitle(): string |
|
40
|
|
|
{ |
|
41
|
1 |
|
return $this->genre->getTitle(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
1 |
|
public function getGenreId(): int |
|
45
|
|
|
{ |
|
46
|
1 |
|
return $this->genre->getId(); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
1 |
|
public function getMappedItemType(): GenreMapEnum |
|
50
|
|
|
{ |
|
51
|
1 |
|
return $this->mapped_item_type; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
public function setMappedItemType(GenreMapEnum $value): GenreMapInterface |
|
55
|
|
|
{ |
|
56
|
1 |
|
$this->mapped_item_type = $value; |
|
57
|
1 |
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
1 |
|
public function getMappedItemId(): int |
|
61
|
|
|
{ |
|
62
|
1 |
|
return $this->mapped_item_id; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
1 |
|
public function setMappedItemId(int $mapped_item_id): GenreMapInterface |
|
66
|
|
|
{ |
|
67
|
1 |
|
$this->mapped_item_id = $mapped_item_id; |
|
68
|
1 |
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
2 |
|
public function setGenre(GenreInterface $genre): GenreMapInterface |
|
72
|
|
|
{ |
|
73
|
2 |
|
$this->genre = $genre; |
|
74
|
2 |
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
1 |
|
public function getGenre(): GenreInterface |
|
78
|
|
|
{ |
|
79
|
1 |
|
return $this->genre; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|