|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
8
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
9
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
|
10
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
11
|
|
|
use Doctrine\ORM\Mapping\Index; |
|
12
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
13
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
14
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
15
|
|
|
use Stu\Orm\Repository\IgnoreListRepository; |
|
16
|
|
|
|
|
17
|
|
|
#[Table(name: 'stu_ignorelist')] |
|
18
|
|
|
#[Index(name: 'user_recipient_idx', columns: ['user_id', 'recipient'])] |
|
19
|
|
|
#[Entity(repositoryClass: IgnoreListRepository::class)] |
|
20
|
|
|
class IgnoreList |
|
21
|
|
|
{ |
|
22
|
|
|
#[Id] |
|
23
|
|
|
#[Column(type: 'integer')] |
|
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
25
|
|
|
private int $id; |
|
26
|
|
|
|
|
27
|
|
|
#[Column(type: 'integer')] |
|
28
|
|
|
private int $user_id = 0; |
|
29
|
|
|
|
|
30
|
|
|
#[Column(type: 'integer')] |
|
31
|
|
|
private int $recipient = 0; |
|
32
|
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
|
34
|
|
|
private int $date = 0; |
|
35
|
|
|
|
|
36
|
|
|
#[ManyToOne(targetEntity: User::class)] |
|
37
|
|
|
#[JoinColumn(name: 'user_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
38
|
|
|
private User $user; |
|
39
|
|
|
|
|
40
|
|
|
#[ManyToOne(targetEntity: User::class)] |
|
41
|
|
|
#[JoinColumn(name: 'recipient', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
42
|
|
|
private User $opponent; |
|
43
|
|
|
|
|
44
|
|
|
public function getId(): int |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->id; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getUserId(): int |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->user_id; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getRecipientId(): int |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->recipient; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getDate(): int |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->date; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function setDate(int $date): IgnoreList |
|
65
|
|
|
{ |
|
66
|
|
|
$this->date = $date; |
|
67
|
|
|
|
|
68
|
|
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getRecipient(): User |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->opponent; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function setRecipient(User $recipient): IgnoreList |
|
77
|
|
|
{ |
|
78
|
|
|
$this->opponent = $recipient; |
|
79
|
|
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getUser(): User |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->user; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function setUser(User $user): IgnoreList |
|
88
|
|
|
{ |
|
89
|
|
|
$this->user = $user; |
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|