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\Ship\Wormhole\WormholeEntryTypeEnum; |
15
|
|
|
use Stu\Component\Ship\Wormhole\WormholeEntryModeEnum; |
16
|
|
|
use Stu\Orm\Repository\WormholeRestrictionRepository; |
17
|
|
|
|
18
|
|
|
#[Table(name: 'stu_wormhole_restrictions')] |
19
|
|
|
#[Entity(repositoryClass: WormholeRestrictionRepository::class)] |
20
|
|
|
class WormholeRestriction |
21
|
|
|
{ |
22
|
|
|
#[Id] |
23
|
|
|
#[Column(type: 'integer')] |
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
25
|
|
|
private int $id; |
26
|
|
|
|
27
|
|
|
#[ManyToOne(targetEntity: WormholeEntry::class)] |
28
|
|
|
#[JoinColumn(name: 'wormhole_entry_id', nullable: false, referencedColumnName: 'id')] |
29
|
|
|
private WormholeEntry $wormholeEntry; |
30
|
|
|
|
31
|
|
|
#[Column(type: 'integer')] |
32
|
|
|
private int $target = 0; |
33
|
|
|
|
34
|
|
|
#[Column(type: 'smallint', enumType: WormholeEntryTypeEnum::class, nullable: true)] |
35
|
|
|
private ?WormholeEntryTypeEnum $privilege_type = null; |
36
|
|
|
|
37
|
|
|
#[Column(type: 'integer', nullable: true)] |
38
|
|
|
private ?int $mode = WormholeEntryModeEnum::ALLOW->value; |
39
|
|
|
|
40
|
|
|
public function getId(): int |
41
|
|
|
{ |
42
|
|
|
return $this->id; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getWormholeEntry(): WormholeEntry |
46
|
|
|
{ |
47
|
|
|
return $this->wormholeEntry; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function setWormholeEntry(WormholeEntry $wormholeEntry): WormholeRestriction |
51
|
|
|
{ |
52
|
|
|
$this->wormholeEntry = $wormholeEntry; |
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getTargetId(): int |
57
|
|
|
{ |
58
|
|
|
return $this->target; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function setTargetId(int $targetId): WormholeRestriction |
62
|
|
|
{ |
63
|
|
|
$this->target = $targetId; |
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getPrivilegeType(): ?WormholeEntryTypeEnum |
68
|
|
|
{ |
69
|
|
|
return $this->privilege_type; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function setPrivilegeType(?WormholeEntryTypeEnum $privilegeType): WormholeRestriction |
73
|
|
|
{ |
74
|
|
|
$this->privilege_type = $privilegeType; |
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
public function getMode(): ?int |
80
|
|
|
{ |
81
|
|
|
return $this->mode; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function setMode(?int $mode): WormholeRestriction |
85
|
|
|
{ |
86
|
|
|
$this->mode = $mode; |
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|