ENHANCEMENT: islocked using doctrine

This commit is contained in:
Jeroen De Meerleer 2022-05-18 17:16:39 +02:00
parent d700458f31
commit ed4a907cdd
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 2 additions and 4 deletions

View File

@ -464,10 +464,8 @@ class JobRepository extends EntityRepository
public function isLockedJob(int $id = 0): bool public function isLockedJob(int $id = 0): bool
{ {
$jobsSql = "SELECT id FROM job WHERE id = :id AND running != :status"; $job = $this->find($id);
$params = [':status' => 0, ':id' => $id]; return $job->getRunning() != 0;
return count($this->getEntityManager()->getConnection()->prepare($jobsSql)->executeQuery($params)->fetchAllAssociative()) > 0;
} }
public function addJob(array $values) public function addJob(array $values)