PlaybackHistory   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 88.24%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 28
dl 0
loc 61
ccs 15
cts 17
cp 0.8824
rs 10
c 1
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUser() 0 4 1
A getSong() 0 3 1
A setSong() 0 4 1
A getPlayDate() 0 3 1
A getId() 0 3 1
A setPlayDate() 0 4 1
A getUser() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Model;
6
7
use DateTimeInterface;
8
use Doctrine\DBAL\Types\Types;
9
use Doctrine\ORM\Mapping as ORM;
10
use Uxmp\Core\Orm\Repository\PlaybackHistoryRepository;
11
12
/**
13
 * Describes the database model which contains the playback history of all users
14
 */
15
#[ORM\Entity(repositoryClass: PlaybackHistoryRepository::class)]
16
#[ORM\Table(name: 'playback_history')]
17
class PlaybackHistory implements PlaybackHistoryInterface
18
{
19
    #[ORM\Column(type: Types::INTEGER)]
20
    #[ORM\Id, ORM\GeneratedValue(strategy: 'AUTO')]
21
    private int $id;
22
23
    #[ORM\Column(type: Types::INTEGER)]
24
    private int $song_id;
0 ignored issues
show
introduced by
The private property $song_id is not used, and could be removed.
Loading history...
25
26
    #[ORM\Column(type: Types::INTEGER)]
27
    private int $user_id;
0 ignored issues
show
introduced by
The private property $user_id is not used, and could be removed.
Loading history...
28
29
    #[ORM\Column(type: Types::DATETIME_MUTABLE)]
30
    private DateTimeInterface $play_date;
31
32
    #[ORM\ManyToOne(targetEntity: UserInterface::class)]
33
    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
34
    private UserInterface $user;
35
36
    #[ORM\ManyToOne(targetEntity: SongInterface::class)]
37
    #[ORM\JoinColumn(name: 'song_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
38
    private SongInterface $song;
39
40
    public function getId(): int
41
    {
42
        return $this->id;
43
    }
44
45 1
    public function getUser(): UserInterface
46
    {
47 1
        return $this->user;
48
    }
49
50 1
    public function setUser(UserInterface $user): PlaybackHistoryInterface
51
    {
52 1
        $this->user = $user;
53 1
        return $this;
54
    }
55
56 1
    public function getSong(): SongInterface
57
    {
58 1
        return $this->song;
59
    }
60
61 1
    public function setSong(SongInterface $song): PlaybackHistoryInterface
62
    {
63 1
        $this->song = $song;
64 1
        return $this;
65
    }
66
67 1
    public function getPlayDate(): DateTimeInterface
68
    {
69 1
        return $this->play_date;
70
    }
71
72 1
    public function setPlayDate(DateTimeInterface $play_date): PlaybackHistoryInterface
73
    {
74 1
        $this->play_date = $play_date;
75 1
        return $this;
76
    }
77
}
78