|
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; |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
#[ORM\Column(type: Types::INTEGER)] |
|
27
|
|
|
private int $user_id; |
|
|
|
|
|
|
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
|
|
|
|