|
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\OneToOne; |
|
13
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
14
|
|
|
|
|
15
|
|
|
#[Table(name: 'stu_game_turns')] |
|
16
|
|
|
#[Index(name: 'turn_idx', columns: ['turn'])] |
|
17
|
|
|
#[Entity(repositoryClass: 'Stu\Orm\Repository\GameTurnRepository')] |
|
18
|
|
|
class GameTurn implements GameTurnInterface |
|
19
|
|
|
{ |
|
20
|
|
|
#[Id] |
|
21
|
|
|
#[Column(type: 'integer')] |
|
22
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
23
|
|
|
private int $id; |
|
24
|
|
|
|
|
25
|
|
|
#[Column(type: 'integer')] |
|
26
|
|
|
private int $turn = 0; |
|
27
|
|
|
|
|
28
|
|
|
#[Column(type: 'integer')] |
|
29
|
|
|
private int $startdate = 0; |
|
30
|
|
|
|
|
31
|
|
|
#[Column(type: 'integer')] |
|
32
|
|
|
private int $enddate; |
|
33
|
|
|
|
|
34
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
35
|
|
|
private ?int $pirate_fleets = 0; |
|
36
|
|
|
|
|
37
|
|
|
#[OneToOne(targetEntity: 'GameTurnStats', mappedBy: 'turn')] |
|
38
|
|
|
private ?GameTurnStatsInterface $stats = null; |
|
39
|
|
|
|
|
40
|
|
|
public function getId(): int |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->id; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getTurn(): int |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->turn; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function setTurn(int $turn): GameTurnInterface |
|
51
|
|
|
{ |
|
52
|
|
|
$this->turn = $turn; |
|
53
|
|
|
|
|
54
|
|
|
return $this; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getStart(): int |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->startdate; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function setStart(int $start): GameTurnInterface |
|
63
|
|
|
{ |
|
64
|
|
|
$this->startdate = $start; |
|
65
|
|
|
|
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getEnd(): int |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->enddate; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function setEnd(int $end): GameTurnInterface |
|
75
|
|
|
{ |
|
76
|
|
|
$this->enddate = $end; |
|
77
|
|
|
|
|
78
|
|
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getStats(): ?GameTurnStatsInterface |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->stats; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function getPirateFleets(): ?int |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->pirate_fleets; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function setPirateFleets(int $pirateFleets): GameTurnInterface |
|
92
|
|
|
{ |
|
93
|
|
|
$this->pirate_fleets = $pirateFleets; |
|
94
|
|
|
|
|
95
|
|
|
return $this; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|