1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
6
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
8
|
|
|
use Doctrine\Common\Collections\Collection; |
9
|
|
|
use Doctrine\ORM\Mapping\Column; |
10
|
|
|
use Doctrine\ORM\Mapping\Entity; |
11
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
12
|
|
|
use Doctrine\ORM\Mapping\Id; |
13
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
14
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
15
|
|
|
use Doctrine\ORM\Mapping\OneToMany; |
16
|
|
|
use Doctrine\ORM\Mapping\OrderBy; |
17
|
|
|
use Doctrine\ORM\Mapping\Table; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @Entity(repositoryClass="Stu\Orm\Repository\ColonySandboxRepository") |
21
|
|
|
* @Table( |
22
|
|
|
* name="stu_colony_sandbox", |
23
|
|
|
* indexes={ |
24
|
|
|
* } |
25
|
|
|
* ) |
26
|
|
|
**/ |
27
|
|
|
class ColonySandbox implements ColonySandboxInterface |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @Id |
31
|
|
|
* @Column(type="integer") |
32
|
|
|
* @GeneratedValue(strategy="IDENTITY") |
33
|
|
|
* |
34
|
|
|
*/ |
35
|
|
|
private int $id; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @Column(type="integer") |
39
|
|
|
*/ |
40
|
|
|
private int $colony_id; |
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @Column(type="string") |
44
|
|
|
*/ |
45
|
|
|
private string $name = ''; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @Column(type="integer", length=5) |
49
|
|
|
*/ |
50
|
|
|
private int $bev_work = 0; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @Column(type="integer", length=5) |
54
|
|
|
*/ |
55
|
|
|
private int $bev_max = 0; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @Column(type="integer", length=5) |
59
|
|
|
*/ |
60
|
|
|
private int $max_eps = 0; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @Column(type="integer", length=5) |
64
|
|
|
*/ |
65
|
|
|
private int $max_storage = 0; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @Column(type="text", nullable=true) |
69
|
|
|
*/ |
70
|
|
|
private ?string $mask = null; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var ArrayCollection<int, PlanetFieldInterface> |
74
|
|
|
* |
75
|
|
|
* @OneToMany(targetEntity="PlanetField", mappedBy="colony", indexBy="field_id", fetch="EXTRA_LAZY") |
76
|
|
|
* @OrderBy({"field_id": "ASC"}) |
77
|
|
|
*/ |
78
|
|
|
private Collection $planetFields; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @ManyToOne(targetEntity="Colony") |
82
|
|
|
* @JoinColumn(name="colony_id", referencedColumnName="id") |
83
|
|
|
*/ |
84
|
|
|
private ColonyInterface $colony; |
85
|
|
|
|
86
|
|
|
public function __construct() |
87
|
|
|
{ |
88
|
|
|
$this->planetFields = new ArrayCollection(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function getId(): int |
92
|
|
|
{ |
93
|
|
|
return $this->id; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function getColony(): ColonyInterface |
97
|
|
|
{ |
98
|
|
|
return $this->colony; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getName(): string |
102
|
|
|
{ |
103
|
|
|
return $this->name; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function setName(string $name): ColonySandboxInterface |
107
|
|
|
{ |
108
|
|
|
$this->name = $name; |
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function getWorkers(): int |
113
|
|
|
{ |
114
|
|
|
return $this->bev_work; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function setWorkers(int $bev_work): ColonySandboxInterface |
118
|
|
|
{ |
119
|
|
|
$this->bev_work = $bev_work; |
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function getMaxBev(): int |
124
|
|
|
{ |
125
|
|
|
return $this->bev_max; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function setMaxBev(int $bev_max): ColonySandboxInterface |
129
|
|
|
{ |
130
|
|
|
$this->bev_max = $bev_max; |
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getMaxEps(): int |
135
|
|
|
{ |
136
|
|
|
return $this->max_eps; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function setMaxEps(int $max_eps): ColonySandboxInterface |
140
|
|
|
{ |
141
|
|
|
$this->max_eps = $max_eps; |
142
|
|
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function getMaxStorage(): int |
146
|
|
|
{ |
147
|
|
|
return $this->max_storage; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function setMaxStorage(int $max_storage): ColonySandboxInterface |
151
|
|
|
{ |
152
|
|
|
$this->max_storage = $max_storage; |
153
|
|
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function getMask(): ?string |
157
|
|
|
{ |
158
|
|
|
return $this->mask; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
public function setMask(?string $mask): ColonySandboxInterface |
162
|
|
|
{ |
163
|
|
|
$this->mask = $mask; |
164
|
|
|
return $this; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function getPlanetFields(): Collection |
168
|
|
|
{ |
169
|
|
|
return $this->planetFields; |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
|