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\OneToOne; |
14
|
|
|
use Doctrine\ORM\Mapping\Table; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @Entity(repositoryClass="Stu\Orm\Repository\ShipTakeoverRepository") |
18
|
|
|
* @Table( |
19
|
|
|
* name="stu_ship_takeover", |
20
|
|
|
* indexes={ |
21
|
|
|
* @Index(name="ship_takeover_source_idx", columns={"source_ship_id"}), |
22
|
|
|
* @Index(name="ship_takeover_target_idx", columns={"target_ship_id"}) |
23
|
|
|
* } |
24
|
|
|
* ) |
25
|
|
|
**/ |
26
|
|
|
class ShipTakeover implements ShipTakeoverInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @Id |
30
|
|
|
* @Column(type="integer") |
31
|
|
|
* @GeneratedValue(strategy="IDENTITY") |
32
|
|
|
* |
33
|
|
|
*/ |
34
|
|
|
private int $id; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @Column(type="integer") |
38
|
|
|
* |
39
|
|
|
*/ |
40
|
|
|
private int $source_ship_id; |
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @Column(type="integer") |
44
|
|
|
* |
45
|
|
|
*/ |
46
|
|
|
private int $target_ship_id; |
|
|
|
|
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @Column(type="integer") |
50
|
|
|
* |
51
|
|
|
*/ |
52
|
|
|
private int $start_turn = 0; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @Column(type="integer") |
56
|
|
|
* |
57
|
|
|
*/ |
58
|
|
|
private int $prestige = 0; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* |
62
|
|
|
* @OneToOne(targetEntity="Ship") |
63
|
|
|
* @JoinColumn(name="source_ship_id", referencedColumnName="id", onDelete="CASCADE") |
64
|
|
|
*/ |
65
|
|
|
private ShipInterface $source; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* |
69
|
|
|
* @OneToOne(targetEntity="Ship") |
70
|
|
|
* @JoinColumn(name="target_ship_id", referencedColumnName="id", onDelete="CASCADE") |
71
|
|
|
*/ |
72
|
|
|
private ShipInterface $target; |
73
|
|
|
|
74
|
|
|
public function getId(): int |
75
|
|
|
{ |
76
|
|
|
return $this->id; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function setSourceShip(ShipInterface $ship): ShipTakeoverInterface |
80
|
|
|
{ |
81
|
|
|
$this->source = $ship; |
82
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getSourceShip(): ShipInterface |
87
|
|
|
{ |
88
|
|
|
return $this->source; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function setTargetShip(ShipInterface $ship): ShipTakeoverInterface |
92
|
|
|
{ |
93
|
|
|
$this->target = $ship; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getTargetShip(): ShipInterface |
99
|
|
|
{ |
100
|
|
|
return $this->target; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getStartTurn(): int |
104
|
|
|
{ |
105
|
|
|
return $this->start_turn; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function setStartTurn(int $turn): ShipTakeoverInterface |
109
|
|
|
{ |
110
|
|
|
$this->start_turn = $turn; |
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getPrestige(): int |
115
|
|
|
{ |
116
|
|
|
return $this->prestige; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setPrestige(int $prestige): ShipTakeoverInterface |
120
|
|
|
{ |
121
|
|
|
$this->prestige = $prestige; |
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|