|
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\Orm\Entity\AstronomicalEntry; |
|
10
|
|
|
use Stu\Orm\Entity\AstronomicalEntryInterface; |
|
11
|
|
|
use Stu\Orm\Entity\ShipInterface; |
|
12
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @extends EntityRepository<AstronomicalEntry> |
|
16
|
|
|
*/ |
|
17
|
|
|
final class AstroEntryRepository extends EntityRepository implements AstroEntryRepositoryInterface |
|
18
|
|
|
{ |
|
19
|
|
|
#[Override] |
|
20
|
|
|
public function prototype(): AstronomicalEntryInterface |
|
21
|
|
|
{ |
|
22
|
|
|
return new AstronomicalEntry(); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
#[Override] |
|
26
|
|
|
public function getByShipLocation(ShipInterface $ship, bool $showOverSystem = true): ?AstronomicalEntryInterface |
|
27
|
|
|
{ |
|
28
|
|
|
$system = $ship->getSystem(); |
|
29
|
|
|
if ($system === null && $showOverSystem) { |
|
30
|
|
|
$system = $ship->isOverSystem(); |
|
31
|
|
|
} |
|
32
|
|
|
$mapRegion = $system === null ? $ship->getMapRegion() : null; |
|
33
|
|
|
|
|
34
|
|
|
return $this->findOneBy( |
|
35
|
|
|
[ |
|
36
|
|
|
'user_id' => $ship->getUser()->getId(), |
|
37
|
|
|
'systems_id' => $system === null ? null : $system->getId(), |
|
38
|
|
|
'region_id' => $mapRegion === null ? null : $mapRegion->getId() |
|
39
|
|
|
] |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
#[Override] |
|
44
|
|
|
public function save(AstronomicalEntryInterface $entry): void |
|
45
|
|
|
{ |
|
46
|
|
|
$em = $this->getEntityManager(); |
|
47
|
|
|
|
|
48
|
|
|
$em->persist($entry); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
#[Override] |
|
52
|
|
|
public function delete(AstronomicalEntryInterface $entry): void |
|
53
|
|
|
{ |
|
54
|
|
|
$em = $this->getEntityManager(); |
|
55
|
|
|
|
|
56
|
|
|
$em->remove($entry); |
|
57
|
|
|
$em->flush(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
#[Override] |
|
62
|
|
|
public function truncateAllAstroEntries(): void |
|
63
|
|
|
{ |
|
64
|
|
|
$this->getEntityManager()->createQuery( |
|
65
|
|
|
sprintf( |
|
66
|
|
|
'DELETE FROM %s ae', |
|
67
|
|
|
AstronomicalEntry::class |
|
68
|
|
|
) |
|
69
|
|
|
)->execute(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** @return array<AstronomicalEntryInterface> */ |
|
73
|
|
|
#[Override] |
|
74
|
|
|
public function getByUser(UserInterface $user): array |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->findBy( |
|
77
|
|
|
['user_id' => $user->getId()] |
|
78
|
|
|
); |
|
79
|
|
|
} |
|
80
|
|
|
} |
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