fix: improve some database queries

This commit is contained in:
Björn Fromme
2025-03-19 09:13:02 +01:00
parent 374e01cf1d
commit 9aaf996e07
6 changed files with 34 additions and 12 deletions
+6 -3
View File
@@ -87,12 +87,13 @@ class UploadRepository extends ServiceEntityRepository
$qb = $this->createQueryBuilder('upload');
return $qb
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer')
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer', 'user')
->innerJoin('upload.disposition', 'disposition')
->innerJoin('disposition.assignment', 'assignment')
->innerJoin('assignment.jobProfile', 'job_profile')
->innerJoin('assignment.destination', 'destination')
->innerJoin('disposition.teamer', 'teamer')
->innerJoin('teamer.user', 'user')
->where($qb->expr()->andX(
$qb->expr()->eq('upload.type', ':type'),
$qb->expr()->eq('upload.status', ':status'),
@@ -120,12 +121,13 @@ class UploadRepository extends ServiceEntityRepository
$qb = $this->createQueryBuilder('upload');
$qb
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer')
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer', 'user')
->innerJoin('upload.disposition', 'disposition')
->innerJoin('disposition.assignment', 'assignment')
->innerJoin('assignment.jobProfile', 'job_profile')
->innerJoin('assignment.destination', 'destination')
->innerJoin('disposition.teamer', 'teamer')
->innerJoin('teamer.user', 'user')
->addOrderBy('FIELD(upload.status, :checked, :new)', 'DESC')
->setParameter('new', Upload::STATUS_NEW)
->setParameter('checked', Upload::STATUS_CHECKED)
@@ -188,9 +190,10 @@ class UploadRepository extends ServiceEntityRepository
$qb = $this->createQueryBuilder('upload');
return $qb
->select('upload', 'owner', 'teamer', 'disposition', 'assignment')
->select('upload', 'owner', 'teamer', 'user', 'disposition', 'assignment')
->innerJoin('upload.owner', 'owner')
->innerJoin('owner.teamer', 'teamer')
->innerJoin('teamer.user', 'user')
->leftJoin('upload.disposition', 'disposition')
->leftJoin('disposition.assignment', 'assignment')
->where($qb->expr()->andX(