BUGFIX: using idiskey

This commit is contained in:
Jeroen De Meerleer 2022-05-18 11:23:41 +02:00
parent fee48b7a99
commit 1569c1564a
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 14 additions and 7 deletions

View File

@ -42,13 +42,20 @@ class JobRepository extends EntityRepository
public function getAllJobs(bool $idiskey = false)
{
$qb = $this->createQueryBuilder('job');
/** @var Job[] $jobs */
$jobs = $qb
->orderBy('job.name')
->where('job.id = job.id')
->addOrderBy("JSON_VALUE(job.data, '$.host')")
->addOrderBy("JSON_VALUE(job.data, '$.service')")
->getQuery()->getResult();
$jobs = $qb->where('job.id = job.id');
if($idiskey) {
$jobs = $jobs->orderBy('job.id');
} else {
$jobs = $jobs
->orderBy('job.name')
->addOrderBy("JSON_VALUE(job.data, '$.host')")
->addOrderBy("JSON_VALUE(job.data, '$.service')");
}
/** @var Job $jobs */
$jobs = $jobs->getQuery()->getResult();
return $this->parseJobs($jobs);
}