|
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\Index; |
|
14
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
15
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
16
|
|
|
use Doctrine\ORM\Mapping\OneToMany; |
|
17
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
18
|
|
|
use Stu\Orm\Repository\NPCQuestRepository; |
|
19
|
|
|
|
|
20
|
|
|
#[Table(name: 'stu_npc_quests')] |
|
21
|
|
|
#[Index(name: 'npc_quest_user_idx', columns: ['user_id'])] |
|
22
|
|
|
#[Index(name: 'npc_quest_award_idx', columns: ['award_id'])] |
|
23
|
|
|
#[Index(name: 'npc_quest_plot_idx', columns: ['plot_id'])] |
|
24
|
|
|
#[Entity(repositoryClass: NPCQuestRepository::class)] |
|
25
|
|
|
class NPCQuest |
|
26
|
|
|
{ |
|
27
|
|
|
#[Id] |
|
28
|
|
|
#[Column(type: 'integer')] |
|
29
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
30
|
|
|
private int $id; |
|
31
|
|
|
|
|
32
|
|
|
#[Column(type: 'integer')] |
|
33
|
|
|
private int $user_id = 0; |
|
34
|
|
|
|
|
35
|
|
|
#[Column(type: 'text')] |
|
36
|
|
|
private string $title = ''; |
|
37
|
|
|
|
|
38
|
|
|
#[Column(type: 'text')] |
|
39
|
|
|
private string $text = ''; |
|
40
|
|
|
|
|
41
|
|
|
/** @var ?array<int> */ |
|
42
|
|
|
#[Column(type: 'json', nullable: true)] |
|
43
|
|
|
private ?array $factions = null; |
|
44
|
|
|
|
|
45
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
46
|
|
|
private ?int $prestige = null; |
|
47
|
|
|
|
|
48
|
|
|
/** @var ?array<int, int> */ |
|
49
|
|
|
#[Column(type: 'json', nullable: true)] |
|
50
|
|
|
private ?array $commodity_reward = null; |
|
51
|
|
|
|
|
52
|
|
|
/** @var ?array<int, int> */ |
|
53
|
|
|
#[Column(type: 'json', nullable: true)] |
|
54
|
|
|
private ?array $spacecrafts = null; |
|
55
|
|
|
|
|
56
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
57
|
|
|
private ?int $award_id = null; |
|
58
|
|
|
|
|
59
|
|
|
#[Column(type: 'integer')] |
|
60
|
|
|
private int $time = 0; |
|
61
|
|
|
|
|
62
|
|
|
#[Column(type: 'integer')] |
|
63
|
|
|
private int $start = 0; |
|
64
|
|
|
|
|
65
|
|
|
#[Column(type: 'integer')] |
|
66
|
|
|
private int $application_end = 0; |
|
67
|
|
|
|
|
68
|
|
|
#[Column(name: '"end"', type: 'integer', nullable: true)] |
|
69
|
|
|
private ?int $end = null; |
|
70
|
|
|
|
|
71
|
|
|
/** @var ?array<int> */ |
|
72
|
|
|
#[Column(type: 'json', nullable: true)] |
|
73
|
|
|
private ?array $secret = null; |
|
74
|
|
|
|
|
75
|
|
|
#[Column(type: 'boolean')] |
|
76
|
|
|
private bool $approval_required = false; |
|
77
|
|
|
|
|
78
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
79
|
|
|
private ?int $applicant_max = null; |
|
80
|
|
|
|
|
81
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
82
|
|
|
private ?int $plot_id = null; |
|
83
|
|
|
|
|
84
|
|
|
#[ManyToOne(targetEntity: User::class)] |
|
85
|
|
|
#[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
86
|
|
|
private ?User $user = null; |
|
87
|
|
|
|
|
88
|
|
|
#[ManyToOne(targetEntity: Award::class)] |
|
89
|
|
|
#[JoinColumn(name: 'award_id', referencedColumnName: 'id', onDelete: 'SET NULL')] |
|
90
|
|
|
private ?Award $award = null; |
|
91
|
|
|
|
|
92
|
|
|
#[ManyToOne(targetEntity: RpgPlot::class)] |
|
93
|
|
|
#[JoinColumn(name: 'plot_id', referencedColumnName: 'id', onDelete: 'SET NULL')] |
|
94
|
|
|
private ?RpgPlot $plot = null; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @var Collection<int, NPCQuestUser> |
|
98
|
|
|
*/ |
|
99
|
|
|
#[OneToMany(targetEntity: NPCQuestUser::class, mappedBy: 'quest')] |
|
100
|
|
|
private Collection $questUsers; |
|
101
|
|
|
|
|
102
|
|
|
public function __construct() |
|
103
|
|
|
{ |
|
104
|
|
|
$this->questUsers = new ArrayCollection(); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function getId(): int |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->id; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function getUserId(): int |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->user_id; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
public function setUserId(int $userId): NPCQuest |
|
118
|
|
|
{ |
|
119
|
|
|
$this->user_id = $userId; |
|
120
|
|
|
return $this; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
public function getUser(): ?User |
|
124
|
|
|
{ |
|
125
|
|
|
return $this->user; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
public function setUser(?User $user): NPCQuest |
|
129
|
|
|
{ |
|
130
|
|
|
$this->user = $user; |
|
131
|
|
|
return $this; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function getTitle(): string |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->title; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function setTitle(string $title): NPCQuest |
|
140
|
|
|
{ |
|
141
|
|
|
$this->title = $title; |
|
142
|
|
|
return $this; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function getText(): string |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->text; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function setText(string $text): NPCQuest |
|
151
|
|
|
{ |
|
152
|
|
|
$this->text = $text; |
|
153
|
|
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** @return ?array<int> */ |
|
157
|
|
|
public function getFactions(): ?array |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->factions; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** @param ?array<int> $factions */ |
|
163
|
|
|
public function setFactions(?array $factions): NPCQuest |
|
164
|
|
|
{ |
|
165
|
|
|
$this->factions = $factions; |
|
166
|
|
|
return $this; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
public function getPrestige(): ?int |
|
170
|
|
|
{ |
|
171
|
|
|
return $this->prestige; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
public function setPrestige(?int $prestige): NPCQuest |
|
175
|
|
|
{ |
|
176
|
|
|
$this->prestige = $prestige; |
|
177
|
|
|
return $this; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** @return ?array<int, int> */ |
|
181
|
|
|
public function getCommodityReward(): ?array |
|
182
|
|
|
{ |
|
183
|
|
|
return $this->commodity_reward; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** @param ?array<int, int> $commodityReward */ |
|
187
|
|
|
public function setCommodityReward(?array $commodityReward): NPCQuest |
|
188
|
|
|
{ |
|
189
|
|
|
$this->commodity_reward = $commodityReward; |
|
190
|
|
|
return $this; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** @return ?array<int, int> */ |
|
194
|
|
|
public function getSpacecrafts(): ?array |
|
195
|
|
|
{ |
|
196
|
|
|
return $this->spacecrafts; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** @param ?array<int, int> $spacecrafts */ |
|
200
|
|
|
public function setSpacecrafts(?array $spacecrafts): NPCQuest |
|
201
|
|
|
{ |
|
202
|
|
|
$this->spacecrafts = $spacecrafts; |
|
203
|
|
|
return $this; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
public function getAwardId(): ?int |
|
207
|
|
|
{ |
|
208
|
|
|
return $this->award_id; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
public function setAwardId(?int $awardId): NPCQuest |
|
212
|
|
|
{ |
|
213
|
|
|
$this->award_id = $awardId; |
|
214
|
|
|
return $this; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function getAward(): ?Award |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->award; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public function setAward(?Award $award): NPCQuest |
|
223
|
|
|
{ |
|
224
|
|
|
$this->award = $award; |
|
225
|
|
|
return $this; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
public function getTime(): int |
|
229
|
|
|
{ |
|
230
|
|
|
return $this->time; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
public function setTime(int $time): NPCQuest |
|
234
|
|
|
{ |
|
235
|
|
|
$this->time = $time; |
|
236
|
|
|
return $this; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
public function getStart(): int |
|
240
|
|
|
{ |
|
241
|
|
|
return $this->start; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
public function setStart(int $start): NPCQuest |
|
245
|
|
|
{ |
|
246
|
|
|
$this->start = $start; |
|
247
|
|
|
return $this; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
public function getApplicationEnd(): int |
|
251
|
|
|
{ |
|
252
|
|
|
return $this->application_end; |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
public function setApplicationEnd(int $applicationEnd): NPCQuest |
|
256
|
|
|
{ |
|
257
|
|
|
$this->application_end = $applicationEnd; |
|
258
|
|
|
return $this; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
public function getEnd(): ?int |
|
262
|
|
|
{ |
|
263
|
|
|
return $this->end; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
public function setEnd(?int $end): NPCQuest |
|
267
|
|
|
{ |
|
268
|
|
|
$this->end = $end; |
|
269
|
|
|
return $this; |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
/** @return ?array<int> */ |
|
273
|
|
|
public function getSecret(): ?array |
|
274
|
|
|
{ |
|
275
|
|
|
return $this->secret; |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** @param ?array<int> $secret */ |
|
279
|
|
|
public function setSecret(?array $secret): NPCQuest |
|
280
|
|
|
{ |
|
281
|
|
|
$this->secret = $secret; |
|
282
|
|
|
return $this; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
public function isApprovalRequired(): bool |
|
286
|
|
|
{ |
|
287
|
|
|
return $this->approval_required; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
public function setApprovalRequired(bool $approvalRequired): NPCQuest |
|
291
|
|
|
{ |
|
292
|
|
|
$this->approval_required = $approvalRequired; |
|
293
|
|
|
return $this; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
public function getApplicantMax(): ?int |
|
297
|
|
|
{ |
|
298
|
|
|
return $this->applicant_max; |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
public function setApplicantMax(?int $applicantMax): NPCQuest |
|
302
|
|
|
{ |
|
303
|
|
|
$this->applicant_max = $applicantMax; |
|
304
|
|
|
return $this; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
public function getPlotId(): ?int |
|
308
|
|
|
{ |
|
309
|
|
|
return $this->plot_id; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
public function setPlotId(?int $plotId): NPCQuest |
|
313
|
|
|
{ |
|
314
|
|
|
$this->plot_id = $plotId; |
|
315
|
|
|
return $this; |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
public function getPlot(): ?RpgPlot |
|
319
|
|
|
{ |
|
320
|
|
|
return $this->plot; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
public function setPlot(?RpgPlot $plot): NPCQuest |
|
324
|
|
|
{ |
|
325
|
|
|
$this->plot = $plot; |
|
326
|
|
|
return $this; |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
/** |
|
330
|
|
|
* @return Collection<int, NPCQuestUser> |
|
331
|
|
|
*/ |
|
332
|
|
|
public function getQuestUsers(): Collection |
|
333
|
|
|
{ |
|
334
|
|
|
return $this->questUsers; |
|
335
|
|
|
} |
|
336
|
|
|
} |
|
337
|
|
|
|