diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php index 9f2981e19..d835cd915 100644 --- a/application/controllers/HostController.php +++ b/application/controllers/HostController.php @@ -238,7 +238,7 @@ public function servicesAction(): Generator public function parentsAction(): Generator { - $nodesQuery = $this->fetchNodes(true); + $nodesQuery = $this->fetchDependencyNodes(true); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($nodesQuery); @@ -304,7 +304,7 @@ public function parentsAction(): Generator public function childrenAction(): Generator { - $nodesQuery = $this->fetchNodes(); + $nodesQuery = $this->fetchDependencyNodes(); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($nodesQuery); @@ -411,13 +411,13 @@ public function searchEditorAction(): void } /** - * Fetch the nodes for the current host + * Fetch the dependency nodes of the current host * - * @param bool $fetchParents Whether to fetch the parents or the children + * @param bool $parents Whether to fetch the parents or the children * * @return Query */ - protected function fetchNodes(bool $fetchParents = false): Query + protected function fetchDependencyNodes(bool $parents = false): Query { $query = DependencyNode::on($this->getDb()) ->with([ @@ -434,7 +434,7 @@ protected function fetchNodes(bool $fetchParents = false): Query ]) ->setResultSetClass(VolatileStateResults::class); - $this->joinFix($query, $this->host->id, $fetchParents); + $this->joinFix($query, $this->host->id, $parents); $this->applyRestrictions($query); @@ -447,12 +447,12 @@ protected function createTabs(): Tabs $hasDependencyNode = false; } else { $hasDependencyNode = DependencyNode::on($this->getDb()) - ->columns([new Expression('1')]) - ->filter(Filter::all( - Filter::equal('host_id', $this->host->id), - Filter::unlike('service_id', '*') - )) - ->first() !== null; + ->columns([new Expression('1')]) + ->filter(Filter::all( + Filter::equal('host_id', $this->host->id), + Filter::unlike('service_id', '*') + )) + ->first() !== null; } $tabs = $this->getTabs() diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 81af532a6..d8269412c 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -108,7 +108,7 @@ public function indexAction(): void public function parentsAction(): Generator { - $nodesQuery = $this->fetchNodes(true); + $nodesQuery = $this->fetchDependencyNodes(true); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($nodesQuery); @@ -175,7 +175,7 @@ public function parentsAction(): Generator public function childrenAction(): Generator { - $nodesQuery = $this->fetchNodes(); + $nodesQuery = $this->fetchDependencyNodes(); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($nodesQuery); @@ -381,13 +381,13 @@ public function searchEditorAction(): void } /** - * Fetch the nodes for the current service + * Fetch the dependency nodes of the current service * - * @param bool $fetchParents Whether to fetch the parents or the children + * @param bool $parents Whether to fetch the parents or the children * * @return Query */ - protected function fetchNodes(bool $fetchParents = false): Query + protected function fetchDependencyNodes(bool $parents = false): Query { $query = DependencyNode::on($this->getDb()) ->with([ @@ -403,7 +403,7 @@ protected function fetchNodes(bool $fetchParents = false): Query 'redundancy_group.state' ]) ->filter(Filter::equal( - sprintf('%s.service.id', $fetchParents ? 'child' : 'parent'), + sprintf('%s.service.id', $parents ? 'child' : 'parent'), $this->service->id )) ->setResultSetClass(VolatileStateResults::class); @@ -419,12 +419,12 @@ protected function createTabs(): Tabs $hasDependencyNode = false; } else { $hasDependencyNode = DependencyNode::on($this->getDb()) - ->columns([new Expression('1')]) - ->filter(Filter::all( - Filter::equal('service_id', $this->service->id), - Filter::equal('host_id', $this->service->host_id) - )) - ->first() !== null; + ->columns([new Expression('1')]) + ->filter(Filter::all( + Filter::equal('service_id', $this->service->id), + Filter::equal('host_id', $this->service->host_id) + )) + ->first() !== null; } $tabs = $this->getTabs()