Passed
Push — main ( 199c59...bc8763 )
by Daniel
10:26
created

Disc::getAlbum()   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\Common\Collections\ArrayCollection;
8
use JetBrains\PhpStorm\Pure;
9
10
/**
11
 * @Entity(repositoryClass="\Uxmp\Core\Orm\Repository\DiscRepository")
12
 * @Table(name="disc")
13
 */
14
class Disc implements DiscInterface
15
{
16
    /**
17
     * @Id
18
     * @Column(type="integer")
19
     * @GeneratedValue
20
     */
21
    private int $id;
22
23
    /**
24
     * @Column(type="integer")
25
     */
26
    private int $album_id;
27
28
    /**
29
     * @Column(type="integer")
30
     */
31
    private int $number;
32
33
    /**
34
     * @Column(type="string", length="32", nullable="true", unique=true)
35
     */
36
    private ?string $mbid = null;
37
38
    /**
39
     * @Column(type="integer", length="6")
40
     */
41
    private int $length = 0;
42
43
    /**
44
     * @ManyToOne(targetEntity="Album", inversedBy="discs")
45
     * @JoinColumn(name="album_id", referencedColumnName="id", onDelete="CASCADE")
46
     */
47
    private AlbumInterface $album;
48
49
    /**
50
     * @OneToMany(targetEntity="Song", mappedBy="disc", cascade={"ALL"}, indexBy="id")
51
     *
52
     * @var iterable<SongInterface>
53
     */
54
    private iterable $songs;
55
56 1
    #[Pure]
57
    public function __construct()
58
    {
59 1
        $this->songs = new ArrayCollection();
60 1
    }
61
62
    public function getId(): int
63
    {
64
        return $this->id;
65
    }
66
67
    public function getSongs(): iterable
68
    {
69
        return $this->songs;
70
    }
71
72
    public function getMbid(): ?string
73
    {
74
        return $this->mbid;
75
    }
76
77
    public function setMbid(?string $mbid): DiscInterface
78
    {
79
        $this->mbid = $mbid;
80
        return $this;
81
    }
82
83
    public function getAlbumId(): int
84
    {
85
        return $this->album_id;
86
    }
87
88
    public function setAlbumId(int $album_id): DiscInterface
89
    {
90
        $this->album_id = $album_id;
91
        return $this;
92
    }
93
94
    public function getNumber(): int
95
    {
96
        return $this->number;
97
    }
98
99
    public function setNumber(int $number): DiscInterface
100
    {
101
        $this->number = $number;
102
        return $this;
103
    }
104
105
    public function getAlbum(): AlbumInterface
106
    {
107
        return $this->album;
108
    }
109
110
    public function setAlbum(AlbumInterface $album): DiscInterface
111
    {
112
        $this->album = $album;
113
        return $this;
114
    }
115
116
    public function getLength(): int
117
    {
118
        return $this->length;
119
    }
120
121
    public function setLength(int $length): DiscInterface
122
    {
123
        $this->length = $length;
124
        return $this;
125
    }
126
}
127