1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Orm\Repository; |
6
|
|
|
|
7
|
|
|
use Doctrine\ORM\EntityRepository; |
8
|
|
|
use Override; |
|
|
|
|
9
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
10
|
|
|
use Stu\Orm\Entity\SpacecraftSystem; |
11
|
|
|
use Stu\Orm\Entity\SpacecraftSystemInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @extends EntityRepository<SpacecraftSystem> |
15
|
|
|
*/ |
16
|
|
|
final class SpacecraftSystemRepository extends EntityRepository implements SpacecraftSystemRepositoryInterface |
17
|
|
|
{ |
18
|
|
|
#[Override] |
19
|
|
|
public function prototype(): SpacecraftSystemInterface |
20
|
|
|
{ |
21
|
|
|
return new SpacecraftSystem(); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
#[Override] |
25
|
|
|
public function save(SpacecraftSystemInterface $post): void |
26
|
|
|
{ |
27
|
|
|
$em = $this->getEntityManager(); |
28
|
|
|
|
29
|
|
|
$em->persist($post); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
#[Override] |
33
|
|
|
public function delete(SpacecraftSystemInterface $post): void |
34
|
|
|
{ |
35
|
|
|
$em = $this->getEntityManager(); |
36
|
|
|
|
37
|
|
|
$em->remove($post); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
#[Override] |
41
|
|
|
public function getByShip(int $shipId): array |
42
|
|
|
{ |
43
|
|
|
return $this->findBy( |
44
|
|
|
['spacecraft_id' => $shipId], |
45
|
|
|
['system_type' => 'asc'] |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
#[Override] |
50
|
|
|
public function getTrackingShipSystems(int $targetId): array |
51
|
|
|
{ |
52
|
|
|
return $this->getEntityManager() |
53
|
|
|
->createQuery( |
54
|
|
|
sprintf( |
55
|
|
|
'SELECT ss FROM %s ss |
56
|
|
|
WHERE ss.system_type = :systemType |
57
|
|
|
AND ss.data LIKE :target', |
58
|
|
|
SpacecraftSystem::class |
59
|
|
|
) |
60
|
|
|
) |
61
|
|
|
->setParameters([ |
62
|
|
|
'systemType' => SpacecraftSystemTypeEnum::TRACKER, |
63
|
|
|
'target' => sprintf('%%"targetId":%d%%', $targetId) |
64
|
|
|
]) |
65
|
|
|
->getResult(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
#[Override] |
69
|
|
|
public function getWebConstructingShipSystems(int $webId): array |
70
|
|
|
{ |
71
|
|
|
return $this->getEntityManager() |
72
|
|
|
->createQuery( |
73
|
|
|
sprintf( |
74
|
|
|
'SELECT ss FROM %s ss |
75
|
|
|
WHERE ss.system_type = :systemType |
76
|
|
|
AND ss.data LIKE :target', |
77
|
|
|
SpacecraftSystem::class |
78
|
|
|
) |
79
|
|
|
) |
80
|
|
|
->setParameters([ |
81
|
|
|
'systemType' => SpacecraftSystemTypeEnum::THOLIAN_WEB, |
82
|
|
|
'target' => sprintf('%%"webUnderConstructionId":%d%%', $webId) |
83
|
|
|
]) |
84
|
|
|
->getResult(); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
#[Override] |
88
|
|
|
public function getWebOwningShipSystem(int $webId): ?SpacecraftSystemInterface |
89
|
|
|
{ |
90
|
|
|
return $this->getEntityManager() |
91
|
|
|
->createQuery( |
92
|
|
|
sprintf( |
93
|
|
|
'SELECT ss FROM %s ss |
94
|
|
|
WHERE ss.system_type = :systemType |
95
|
|
|
AND ss.data LIKE :target', |
96
|
|
|
SpacecraftSystem::class |
97
|
|
|
) |
98
|
|
|
) |
99
|
|
|
->setParameters([ |
100
|
|
|
'systemType' => SpacecraftSystemTypeEnum::THOLIAN_WEB, |
101
|
|
|
'target' => sprintf('%%"ownedWebId":%d%%', $webId) |
102
|
|
|
]) |
103
|
|
|
->getOneOrNullResult(); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
#[Override] |
107
|
|
|
public function truncateByShip(int $shipId): void |
108
|
|
|
{ |
109
|
|
|
$this->getEntityManager() |
110
|
|
|
->createQuery( |
111
|
|
|
sprintf( |
112
|
|
|
'DELETE FROM %s s WHERE s.spacecraft_id = :shipId', |
113
|
|
|
SpacecraftSystem::class |
114
|
|
|
) |
115
|
|
|
) |
116
|
|
|
->setParameter('shipId', $shipId) |
117
|
|
|
->execute(); |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
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