diff --git a/Entity/Repository/JobManager.php b/Entity/Repository/JobManager.php index 78e66ef7..fb74379c 100644 --- a/Entity/Repository/JobManager.php +++ b/Entity/Repository/JobManager.php @@ -155,7 +155,7 @@ public function findJobForRelatedEntity($command, $relatedEntity, array $states $rsm = new ResultSetMappingBuilder($this->getJobManager()); $rsm->addRootEntityFromClassMetadata('JMSJobQueueBundle:Job', 'j'); - $sql = "SELECT j.* FROM jms_jobs j INNER JOIN jms_job_related_entities r ON r.job_id = j.id WHERE r.related_class = :relClass AND r.related_id = :relId AND j.command = :command"; + $sql = "SELECT j.* FROM jms_jobs j INNER JOIN jms_job_related_entities r ON r.job_id = j.id WHERE r.related_class = :relClass AND r.related_id = :relId AND j.command = :command LIMIT 1"; $params = new ArrayCollection(); $params->add(new Parameter('command', $command)); $params->add(new Parameter('relClass', $relClass));