|
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\JoinColumn; |
|
12
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
13
|
|
|
use Doctrine\ORM\Mapping\OneToMany; |
|
14
|
|
|
use Doctrine\ORM\Mapping\OneToOne; |
|
15
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
16
|
|
|
use Doctrine\ORM\Mapping\UniqueConstraint; |
|
17
|
|
|
use Override; |
|
|
|
|
|
|
18
|
|
|
use Stu\Orm\Repository\StarSystemMapRepository; |
|
19
|
|
|
|
|
20
|
|
|
#[Table(name: 'stu_sys_map')] |
|
21
|
|
|
#[UniqueConstraint(name: 'system_coordinates_idx', columns: ['sx', 'sy', 'systems_id'])] |
|
22
|
|
|
#[Entity(repositoryClass: StarSystemMapRepository::class)] |
|
23
|
|
|
class StarSystemMap extends Location implements StarSystemMapInterface |
|
24
|
|
|
{ |
|
25
|
|
|
#[Column(type: 'smallint')] |
|
26
|
|
|
private int $sx = 0; |
|
27
|
|
|
|
|
28
|
|
|
#[Column(type: 'smallint')] |
|
29
|
|
|
private int $sy = 0; |
|
30
|
|
|
|
|
31
|
|
|
#[Column(type: 'integer')] |
|
32
|
|
|
private int $systems_id = 0; |
|
33
|
|
|
|
|
34
|
|
|
#[ManyToOne(targetEntity: 'StarSystem', inversedBy: 'fields')] |
|
35
|
|
|
#[JoinColumn(name: 'systems_id', referencedColumnName: 'id')] |
|
36
|
|
|
private StarSystemInterface $starSystem; |
|
37
|
|
|
|
|
38
|
|
|
#[OneToOne(targetEntity: 'Colony', mappedBy: 'starsystem_map')] |
|
39
|
|
|
private ?ColonyInterface $colony = null; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var ArrayCollection<int, WormholeEntryInterface> |
|
43
|
|
|
*/ |
|
44
|
|
|
#[OneToMany(targetEntity: 'WormholeEntry', mappedBy: 'systemMap')] |
|
45
|
|
|
private Collection $wormholeEntries; |
|
46
|
|
|
|
|
47
|
|
|
public function __construct() |
|
48
|
|
|
{ |
|
49
|
|
|
parent::__construct(); |
|
50
|
|
|
$this->wormholeEntries = new ArrayCollection(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
#[Override] |
|
54
|
|
|
public function getLayer(): ?LayerInterface |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->layer; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
#[Override] |
|
60
|
|
|
public function getSx(): int |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->sx; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
#[Override] |
|
66
|
|
|
public function setSx(int $sx): StarSystemMapInterface |
|
67
|
|
|
{ |
|
68
|
|
|
$this->sx = $sx; |
|
69
|
|
|
|
|
70
|
|
|
return $this; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
#[Override] |
|
74
|
|
|
public function getX(): int |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->getSx(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
#[Override] |
|
80
|
|
|
public function getSy(): int |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->sy; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
#[Override] |
|
86
|
|
|
public function setSy(int $sy): StarSystemMapInterface |
|
87
|
|
|
{ |
|
88
|
|
|
$this->sy = $sy; |
|
89
|
|
|
|
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
#[Override] |
|
94
|
|
|
public function getY(): int |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->getSy(); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
#[Override] |
|
100
|
|
|
public function getSystemId(): int |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->systems_id; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
#[Override] |
|
106
|
|
|
public function getSystem(): StarSystemInterface |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->starSystem; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
#[Override] |
|
112
|
|
|
public function setSystem(StarSystemInterface $starSystem): StarSystemMapInterface |
|
113
|
|
|
{ |
|
114
|
|
|
$this->starSystem = $starSystem; |
|
115
|
|
|
|
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
#[Override] |
|
120
|
|
|
public function getColony(): ?ColonyInterface |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->colony; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
#[Override] |
|
126
|
|
|
public function getMapRegion(): ?MapRegionInterface |
|
127
|
|
|
{ |
|
128
|
|
|
return null; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
#[Override] |
|
132
|
|
|
public function getAdministratedRegion(): ?MapRegionInterface |
|
133
|
|
|
{ |
|
134
|
|
|
return null; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
#[Override] |
|
138
|
|
|
public function getInfluenceArea(): ?StarSystemInterface |
|
139
|
|
|
{ |
|
140
|
|
|
return null; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
protected function getWormholeEntries(): Collection |
|
144
|
|
|
{ |
|
145
|
|
|
return $this->wormholeEntries; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
#[Override] |
|
149
|
|
|
public function getFieldStyle(): string |
|
150
|
|
|
{ |
|
151
|
|
|
return "background-image: url('/assets/map/" . $this->getFieldId() . ".png'); opacity:1;"; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
#[Override] |
|
155
|
|
|
public function getSectorId(): ?int |
|
156
|
|
|
{ |
|
157
|
|
|
$parentMap = $this->getSystem()->getMap(); |
|
158
|
|
|
if ($parentMap === null) { |
|
159
|
|
|
return null; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
return $parentMap->getSectorId(); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
#[Override] |
|
166
|
|
|
public function getSectorString(): string |
|
167
|
|
|
{ |
|
168
|
|
|
return sprintf( |
|
169
|
|
|
'%d|%d (%s-%s)', |
|
170
|
|
|
$this->getSx(), |
|
171
|
|
|
$this->getSy(), |
|
172
|
|
|
$this->getSystem()->getName(), |
|
173
|
|
|
$this->getSystem()->isWormhole() ? 'Wurmloch' : 'System' |
|
174
|
|
|
); |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths