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\Component\Station\Dock\DockModeEnum; |
15
|
|
|
use Stu\Component\Station\Dock\DockTypeEnum; |
16
|
|
|
use Stu\Orm\Repository\DockingPrivilegeRepository; |
17
|
|
|
|
18
|
|
|
#[Table(name: 'stu_dockingrights')] |
19
|
|
|
#[Entity(repositoryClass: DockingPrivilegeRepository::class)] |
20
|
|
|
class DockingPrivilege |
21
|
|
|
{ |
22
|
|
|
#[Id] |
23
|
|
|
#[Column(type: 'integer')] |
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
25
|
|
|
private int $id; |
26
|
|
|
|
27
|
|
|
#[Column(type: 'integer')] |
28
|
|
|
private int $target = 0; //TODO create refs to user, ally, ship and faction entities and make cascade delete |
29
|
|
|
|
30
|
|
|
#[Column(type: 'smallint', enumType: DockTypeEnum::class)] |
31
|
|
|
private DockTypeEnum $privilege_type = DockTypeEnum::ALLIANCE; |
32
|
|
|
|
33
|
|
|
#[Column(type: 'smallint', enumType: DockModeEnum::class)] |
34
|
|
|
private DockModeEnum $privilege_mode = DockModeEnum::ALLOW; |
35
|
|
|
|
36
|
|
|
#[ManyToOne(targetEntity: Station::class, inversedBy: 'dockingPrivileges')] |
37
|
|
|
#[JoinColumn(name: 'station_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
38
|
|
|
private Station $station; |
39
|
|
|
|
40
|
|
|
public function getId(): int |
41
|
|
|
{ |
42
|
|
|
return $this->id; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getTargetId(): int |
46
|
|
|
{ |
47
|
|
|
return $this->target; |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
public function setTargetId(int $targetId): DockingPrivilege |
51
|
|
|
{ |
52
|
1 |
|
$this->target = $targetId; |
53
|
1 |
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getPrivilegeType(): DockTypeEnum |
57
|
|
|
{ |
58
|
|
|
return $this->privilege_type; |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function setPrivilegeType(DockTypeEnum $privilegeType): DockingPrivilege |
62
|
|
|
{ |
63
|
1 |
|
$this->privilege_type = $privilegeType; |
64
|
1 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getPrivilegeMode(): DockModeEnum |
68
|
|
|
{ |
69
|
|
|
return $this->privilege_mode; |
70
|
|
|
} |
71
|
|
|
|
72
|
1 |
|
public function setPrivilegeMode(DockModeEnum $privilegeMode): DockingPrivilege |
73
|
|
|
{ |
74
|
1 |
|
$this->privilege_mode = $privilegeMode; |
75
|
1 |
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getStation(): Station |
79
|
|
|
{ |
80
|
|
|
return $this->station; |
81
|
|
|
} |
82
|
|
|
|
83
|
1 |
|
public function setStation(Station $station): DockingPrivilege |
84
|
|
|
{ |
85
|
1 |
|
$this->station = $station; |
86
|
1 |
|
return $this; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|