|
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\JoinColumn; |
|
12
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
13
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
14
|
|
|
use Stu\Orm\Attribute\TruncateOnGameReset; |
|
15
|
|
|
use Stu\Orm\Repository\AllianceApplicationRepository; |
|
16
|
|
|
|
|
17
|
|
|
#[Table(name: 'stu_alliance_applications')] |
|
18
|
|
|
#[Entity(repositoryClass: AllianceApplicationRepository::class)] |
|
19
|
|
|
#[TruncateOnGameReset] |
|
20
|
|
|
class AllianceApplication |
|
21
|
|
|
{ |
|
22
|
|
|
#[Id] |
|
23
|
|
|
#[Column(type: 'integer')] |
|
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
25
|
|
|
private int $id; |
|
26
|
|
|
|
|
27
|
|
|
#[ManyToOne(targetEntity: Alliance::class)] |
|
28
|
|
|
#[JoinColumn(name: 'alliance_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
29
|
|
|
private Alliance $alliance; |
|
30
|
|
|
|
|
31
|
|
|
#[ManyToOne(targetEntity: User::class)] |
|
32
|
|
|
#[JoinColumn(name: 'user_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
33
|
|
|
private User $user; |
|
34
|
|
|
|
|
35
|
|
|
#[Column(type: 'integer')] |
|
36
|
|
|
private int $date; |
|
37
|
|
|
|
|
38
|
|
|
public function getId(): int |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->id; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getAlliance(): Alliance |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->alliance; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function setAlliance(Alliance $alliance): AllianceApplication |
|
49
|
|
|
{ |
|
50
|
|
|
$this->alliance = $alliance; |
|
51
|
|
|
return $this; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getUser(): User |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->user; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setUser(User $user): AllianceApplication |
|
60
|
|
|
{ |
|
61
|
|
|
$this->user = $user; |
|
62
|
|
|
return $this; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getDate(): int |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->date; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function setDate(int $date): AllianceApplication |
|
71
|
|
|
{ |
|
72
|
|
|
$this->date = $date; |
|
73
|
|
|
return $this; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|