Passed
Push — main ( 81c4dd...0f62ea )
by Daniel
03:56
created

Song::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
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 Uxmp\Core\Orm\Repository\SongRepository;
10
11
#[ORM\Entity(repositoryClass: SongRepository::class)]
12
#[ORM\Table(name: 'song')]
13
class Song implements SongInterface
14
{
15
    #[ORM\Column(type: Types::INTEGER)]
16
    #[ORM\Id, ORM\GeneratedValue(strategy: 'AUTO')]
17
    private int $id;
18
19
    #[ORM\Column(type: Types::STRING)]
20
    private string $title = '';
21
22
    #[ORM\Column(type: Types::STRING, nullable: true)]
23
    private ?string $searchTitle = '';
24
25
    #[ORM\Column(type: Types::INTEGER)]
26
    private int $track_number = 0;
27
28
    #[ORM\Column(type: Types::INTEGER)]
29
    private int $artist_id;
0 ignored issues
show
introduced by
The private property $artist_id is not used, and could be removed.
Loading history...
30
31
    #[ORM\Column(type: Types::INTEGER)]
32
    private int $disc_id;
0 ignored issues
show
introduced by
The private property $disc_id is not used, and could be removed.
Loading history...
33
34
    #[ORM\Column(type: Types::TEXT)]
35
    private string $filename;
36
37
    #[ORM\Column(type: Types::INTEGER)]
38
    private int $catalog_id;
0 ignored issues
show
introduced by
The private property $catalog_id is not used, and could be removed.
Loading history...
39
40
    #[ORM\Column(type: Types::STRING, length: 36, unique: true, nullable: true)]
41
    private ?string $mbid = null;
42
43
    #[ORM\Column(type: Types::INTEGER, length: 5)]
44
    private int $length = 0;
45
46
    #[ORM\Column(type: Types::INTEGER, length: 4, nullable: true)]
47
    private ?int $year = null;
48
49
    #[ORM\Column(type: Types::STRING, nullable: true)]
50
    private ?string $mimeType = null;
51
52
    #[ORM\Column(type: Types::INTEGER, options: ['default' => 0])]
53
    private int $fileSize = 0;
54
55
    #[ORM\ManyToOne(targetEntity: DiscInterface::class, inversedBy: 'songs')]
56
    #[ORM\JoinColumn(name: 'disc_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
57
    private DiscInterface $disc;
58
59
    #[ORM\ManyToOne(targetEntity: ArtistInterface::class)]
60
    #[ORM\JoinColumn(name: 'artist_id', referencedColumnName: 'id')]
61
    private ArtistInterface $artist;
62
63
    #[ORM\ManyToOne(targetEntity: CatalogInterface::class)]
64
    #[ORM\JoinColumn(name: 'catalog_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
65
    private CatalogInterface $catalog;
66
67
    public function getId(): int
68
    {
69
        return $this->id;
70
    }
71
72 1
    public function getTitle(): string
73
    {
74 1
        return $this->title;
75
    }
76
77
    public function getSearchTitle(): string
78
    {
79
        return (string) $this->searchTitle;
80
    }
81
82
    public function setSearchTitle(string $searchTitle): SongInterface
83
    {
84
        $this->searchTitle = $searchTitle;
85
        return $this;
86
    }
87
88 1
    public function setTitle(string $title): SongInterface
89
    {
90 1
        $this->title = $title;
91 1
        return $this;
92
    }
93
94 1
    public function getArtist(): ArtistInterface
95
    {
96 1
        return $this->artist;
97
    }
98
99 1
    public function setArtist(ArtistInterface $artist): SongInterface
100
    {
101 1
        $this->artist = $artist;
102 1
        return $this;
103
    }
104
105 1
    public function getTrackNumber(): int
106
    {
107 1
        return $this->track_number;
108
    }
109
110 1
    public function setTrackNumber(int $track_number): SongInterface
111
    {
112 1
        $this->track_number = $track_number;
113 1
        return $this;
114
    }
115
116 1
    public function getFilename(): string
117
    {
118 1
        return $this->filename;
119
    }
120
121 1
    public function setFilename(string $filename): SongInterface
122
    {
123 1
        $this->filename = $filename;
124 1
        return $this;
125
    }
126
127 1
    public function getMbid(): ?string
128
    {
129 1
        return $this->mbid;
130
    }
131
132 1
    public function setMbid(?string $mbid): SongInterface
133
    {
134 1
        $this->mbid = $mbid;
135 1
        return $this;
136
    }
137
138 2
    public function getDisc(): DiscInterface
139
    {
140 2
        return $this->disc;
141
    }
142
143 2
    public function setDisc(DiscInterface $disc): SongInterface
144
    {
145 2
        $this->disc = $disc;
146 2
        return $this;
147
    }
148
149 1
    public function getCatalog(): CatalogInterface
150
    {
151 1
        return $this->catalog;
152
    }
153
154 1
    public function setCatalog(CatalogInterface $catalog): SongInterface
155
    {
156 1
        $this->catalog = $catalog;
157 1
        return $this;
158
    }
159
160 1
    public function getLength(): int
161
    {
162 1
        return $this->length;
163
    }
164
165 1
    public function setLength(int $length): SongInterface
166
    {
167 1
        $this->length = $length;
168 1
        return $this;
169
    }
170
171 1
    public function getType(): FavoriteItemTypeEnum
172
    {
173 1
        return FavoriteItemTypeEnum::SONG;
174
    }
175
176 1
    public function getYear(): ?int
177
    {
178 1
        return $this->year;
179
    }
180
181 1
    public function setYear(?int $year): SongInterface
182
    {
183 1
        $this->year = $year;
184 1
        return $this;
185
    }
186
187 1
    public function getMimeType(): ?string
188
    {
189 1
        return $this->mimeType;
190
    }
191
192 1
    public function setMimeType(?string $mimeType): SongInterface
193
    {
194 1
        $this->mimeType = $mimeType;
195 1
        return $this;
196
    }
197
198 1
    public function getAlbum(): AlbumInterface
199
    {
200 1
        return $this->getDisc()->getAlbum();
201
    }
202
203 1
    public function getFileSize(): int
204
    {
205 1
        return $this->fileSize;
206
    }
207
208 1
    public function setFileSize(int $fileSize): SongInterface
209
    {
210 1
        $this->fileSize = $fileSize;
211 1
        return $this;
212
    }
213
}
214