public function update(JobInterface $job)
    {
        $existingJob = $this->jobManager->findByTicket($job->getTicket());
        if (null == $existingJob) {
            return $this->add($job);
        }

        $this->logger->debug('Update job ' . $job->getTicket(), ['job' => $job]);

        $job = $this->helper->copyJob($job, $existingJob);

        if (null != $this->validator) {
            $errors = $this->validator->validate($job);
            if (count($errors) > 0) {
                throw new ValidationFailedException($errors);
            }
        }

        $this->jobManager->save($job);

        $this->getJobLogger($job)->debug('Updated job', ['job' => $job]);

        return $job;
    }
public function update(JobInterface $job)
    {
        $existingJob = $this->jobManager->findByTicket($job->getTicket());
        if (null == $existingJob) {
            return $this->add($job);
        }

        $this->logger->debug('Update job ' . $job->getTicket(), ['job' => $job]);

        $job = $this->helper->copyJob($job, $existingJob);

        if (null != $this->validator) {
            $errors = $this->validator->validate($job);
            if (count($errors) > 0) {
                throw new ValidationFailedException($errors);
            }
        }

        $this->jobManager->save($job);

        $this->getJobLogger($job)->debug('Updated job', ['job' => $job]);

        return $job;
    }
{@inheritdoc}