Skip to content

Commit bbc866f

Browse files
committed
remove redundant column declarations
1 parent 36c988c commit bbc866f

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Orm/Entity/Anomaly.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ class Anomaly implements SpacecraftDestroyerInterface
3838
#[Column(type: 'integer')]
3939
private int $anomaly_type_id;
4040

41-
#[Column(type: 'integer', nullable: true)]
42-
private ?int $locationId = null;
43-
44-
#[Column(type: 'integer', nullable: true)]
45-
private ?int $parent_id = null;
46-
4741
#[Column(type: 'text', nullable: true)]
4842
private ?string $data = null;
4943

@@ -56,7 +50,7 @@ class Anomaly implements SpacecraftDestroyerInterface
5650
private ?Location $location = null;
5751

5852
#[ManyToOne(targetEntity: Anomaly::class, inversedBy: 'children')]
59-
#[JoinColumn(name: 'parent_id', referencedColumnName: 'id')]
53+
#[JoinColumn(name: 'parent_id', nullable: true, referencedColumnName: 'id')]
6054
private ?Anomaly $parent = null;
6155

6256
/**

src/Orm/Repository/AnomalyRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public function findAllRoot(): array
6565
return $this->getEntityManager()
6666
->createQuery(
6767
sprintf(
68-
'SELECT a FROM %s a
69-
WHERE a.parent_id IS NULL',
68+
'SELECT a FROM %s a
69+
WHERE a.parent IS NULL',
7070
Anomaly::class
7171
)
7272
)
@@ -79,10 +79,10 @@ public function getActiveCountByTypeWithoutParent(AnomalyTypeEnum $type): int
7979
return (int) $this->getEntityManager()
8080
->createQuery(
8181
sprintf(
82-
'SELECT count(a.id) FROM %s a
82+
'SELECT count(a.id) FROM %s a
8383
WHERE a.anomaly_type_id = :type
8484
AND a.remaining_ticks > 0
85-
AND a.parent_id IS NULL',
85+
AND a.parent IS NULL',
8686
Anomaly::class
8787
)
8888
)

0 commit comments

Comments
 (0)