WIP: Implement teamer dashboard

This commit is contained in:
Björn Fromme
2023-11-12 16:41:28 +01:00
parent f8207b6731
commit 286064c739
12 changed files with 335 additions and 196 deletions
+32
View File
@@ -202,4 +202,36 @@ class AssignmentRepository extends ServiceEntityRepository
->getResult()
;
}
public function getNewMatchingTeamerProfile(Teamer $teamer, array $availabilities, int $limit = 5): array
{
$qb = $this->createQueryBuilder('assignment');
$qb
->select('assignment', 'destination', 'job_profile')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->neq('application.teamer', ':teamer'))
->where($qb->expr()->andX(
$qb->expr()->in('assignment.jobProfile', ':jobProfiles'),
$qb->expr()->isNull('application')
))
->setParameter('jobProfiles', $teamer->getJobProfiles())
->setParameter('teamer', $teamer)
;
foreach ($availabilities as $availability) {
$qb->orWhere($qb->expr()->andX(
$qb->expr()->eq('assignment.dateFrom', ':dateFrom'),
$qb->expr()->eq('assignment.dateTo', ':dateTo')
));
}
return $qb
->orderBy('assignment.createdAt', 'DESC')
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
}