PHRAS-3719 filter on job type (#4118)

* filter on job type

* fix
This commit is contained in:
Aina Sitraka
2022-09-07 17:57:49 +03:00
committed by GitHub
parent 54a96ee8df
commit 70b2658302
13 changed files with 1714 additions and 1634 deletions

View File

@@ -379,11 +379,20 @@ class WorkerRunningJobRepository extends EntityRepository
return count($qb->getQuery()->getResult());
}
public function findByStatus(array $status, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
public function findByStatusAndJob(array $status, $jobType, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
{
$qb = $this->createQueryBuilder('w');
if (!empty($status)) {
$qb->where($qb->expr()->in('w.status', $status));
}
if (!empty($jobType)) {
$qb->andWhere('w.work = :work')
->setParameter('work', $jobType);
}
$qb
->where($qb->expr()->in('w.status', $status))
->setFirstResult($start)
->setMaxResults($limit)
->orderBy('w.id', 'DESC')