Skip to content

Commit 3602d5a

Browse files
(Host/Service)Controller: Change method name and fix syntax
1 parent 41601ab commit 3602d5a

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

application/controllers/HostController.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function servicesAction(): Generator
238238

239239
public function parentsAction(): Generator
240240
{
241-
$nodesQuery = $this->fetchNodes(true);
241+
$nodesQuery = $this->fetchDependencyNodes(true);
242242

243243
$limitControl = $this->createLimitControl();
244244
$paginationControl = $this->createPaginationControl($nodesQuery);
@@ -301,7 +301,7 @@ public function parentsAction(): Generator
301301

302302
public function childrenAction(): Generator
303303
{
304-
$nodesQuery = $this->fetchNodes();
304+
$nodesQuery = $this->fetchDependencyNodes();
305305

306306
$limitControl = $this->createLimitControl();
307307
$paginationControl = $this->createPaginationControl($nodesQuery);
@@ -405,13 +405,13 @@ public function searchEditorAction(): void
405405
}
406406

407407
/**
408-
* Fetch the nodes for the current host
408+
* Fetch the dependency nodes of the current host
409409
*
410-
* @param bool $fetchParents Whether to fetch the parents or the children
410+
* @param bool $parents Whether to fetch the parents or the children
411411
*
412412
* @return Query
413413
*/
414-
protected function fetchNodes(bool $fetchParents = false): Query
414+
protected function fetchDependencyNodes(bool $parents = false): Query
415415
{
416416
$query = DependencyNode::on($this->getDb())
417417
->with([
@@ -428,7 +428,7 @@ protected function fetchNodes(bool $fetchParents = false): Query
428428
])
429429
->setResultSetClass(VolatileStateResults::class);
430430

431-
$this->joinFix($query, $this->host->id, $fetchParents);
431+
$this->joinFix($query, $this->host->id, $parents);
432432

433433
$this->applyRestrictions($query);
434434

@@ -441,13 +441,13 @@ protected function createTabs(): Tabs
441441
$hasDependencyNode = false;
442442
} else {
443443
$hasDependencyNode = DependencyNode::on($this->getDb())
444-
->columns([new Expression('1')])
445-
->filter(Filter::all(
446-
Filter::equal('host_id', $this->host->id),
447-
Filter::unlike('service_id', '*')
448-
))
449-
->disableDefaultSort()
450-
->first() !== null;
444+
->columns([new Expression('1')])
445+
->filter(Filter::all(
446+
Filter::equal('host_id', $this->host->id),
447+
Filter::unlike('service_id', '*')
448+
))
449+
->disableDefaultSort()
450+
->first() !== null;
451451
}
452452

453453
$tabs = $this->getTabs()

application/controllers/ServiceController.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function indexAction(): void
108108

109109
public function parentsAction(): Generator
110110
{
111-
$nodesQuery = $this->fetchNodes(true);
111+
$nodesQuery = $this->fetchDependencyNodes(true);
112112

113113
$limitControl = $this->createLimitControl();
114114
$paginationControl = $this->createPaginationControl($nodesQuery);
@@ -172,7 +172,7 @@ public function parentsAction(): Generator
172172

173173
public function childrenAction(): Generator
174174
{
175-
$nodesQuery = $this->fetchNodes();
175+
$nodesQuery = $this->fetchDependencyNodes();
176176

177177
$limitControl = $this->createLimitControl();
178178
$paginationControl = $this->createPaginationControl($nodesQuery);
@@ -375,13 +375,13 @@ public function searchEditorAction(): void
375375
}
376376

377377
/**
378-
* Fetch the nodes for the current service
378+
* Fetch the dependency nodes of the current service
379379
*
380-
* @param bool $fetchParents Whether to fetch the parents or the children
380+
* @param bool $parents Whether to fetch the parents or the children
381381
*
382382
* @return Query
383383
*/
384-
protected function fetchNodes(bool $fetchParents = false): Query
384+
protected function fetchDependencyNodes(bool $parents = false): Query
385385
{
386386
$query = DependencyNode::on($this->getDb())
387387
->with([
@@ -397,7 +397,7 @@ protected function fetchNodes(bool $fetchParents = false): Query
397397
'redundancy_group.state'
398398
])
399399
->filter(Filter::equal(
400-
sprintf('%s.service.id', $fetchParents ? 'child' : 'parent'),
400+
sprintf('%s.service.id', $parents ? 'child' : 'parent'),
401401
$this->service->id
402402
))
403403
->setResultSetClass(VolatileStateResults::class);
@@ -413,13 +413,13 @@ protected function createTabs(): Tabs
413413
$hasDependencyNode = false;
414414
} else {
415415
$hasDependencyNode = DependencyNode::on($this->getDb())
416-
->columns([new Expression('1')])
417-
->filter(Filter::all(
418-
Filter::equal('service_id', $this->service->id),
419-
Filter::equal('host_id', $this->service->host_id)
420-
))
421-
->disableDefaultSort()
422-
->first() !== null;
416+
->columns([new Expression('1')])
417+
->filter(Filter::all(
418+
Filter::equal('service_id', $this->service->id),
419+
Filter::equal('host_id', $this->service->host_id)
420+
))
421+
->disableDefaultSort()
422+
->first() !== null;
423423
}
424424

425425
$tabs = $this->getTabs()

0 commit comments

Comments
 (0)