fix: correct database query

This commit is contained in:
Björn Fromme
2025-04-11 18:00:39 +02:00
parent 3a281cd16c
commit 6b09109e66
+8 -4
View File
@@ -67,6 +67,7 @@ class AssignmentRepository extends ServiceEntityRepository
->select('assignment', 'destination', 'job_profile', 'application', 'disposition')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->leftJoin('job_profile.requiredTrainings', 'required_training')
->where($qb->expr()->andX(
$qb->expr()->orX(
$qb->expr()->gt('destination.dateFrom', ':now'),
@@ -89,8 +90,9 @@ class AssignmentRepository extends ServiceEntityRepository
if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {
$qb
->andWhere($qb->expr()->eq($qb->expr()->count('job_profile.requiredLicenses'), 0))
->andWhere($qb->expr()->eq($qb->expr()->count('job_profile.requiredTrainings'), 0))
->andWhere($qb->expr()->eq('job_profile.requiredLicenses', ':requiredLicenses'))
->setParameter('requiredLicenses', '[]')
->andWhere($qb->expr()->isNull('required_training'))
;
}
@@ -267,6 +269,7 @@ class AssignmentRepository extends ServiceEntityRepository
->select('assignment', 'destination', 'job_profile')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->leftJoin('job_profile.requiredTrainings', 'required_training')
->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer'))
->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer'))
->where($qb->expr()->andX(
@@ -289,8 +292,9 @@ class AssignmentRepository extends ServiceEntityRepository
if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {
$qb
->andWhere($qb->expr()->eq($qb->expr()->count('job_profile.requiredLicenses'), 0))
->andWhere($qb->expr()->eq($qb->expr()->count('job_profile.requiredTrainings'), 0))
->andWhere($qb->expr()->eq('job_profile.requiredLicenses', ':requiredLicenses'))
->setParameter('requiredLicenses', '[]')
->andWhere($qb->expr()->isNull('required_training'))
;
}