/**
  * Mark a job execution as failed
  * @param JobExecution $jobExecution
  */
 public function markAsFailed(JobExecution $jobExecution)
 {
     $jobExecution->setStatus(new BatchStatus(BatchStatus::FAILED));
     $jobExecution->setExitStatus(new ExitStatus(ExitStatus::FAILED));
     $jobExecution->setEndTime(new \DateTime('now'));
     $jobExecution->addFailureException(new \Exception('An exception occured during the job execution'));
     $this->entityManager->persist($jobExecution);
     $this->entityManager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setEndTime(\DateTime $endTime)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setEndTime', array($endTime));
     return parent::setEndTime($endTime);
 }