protected function setError(\Exception $ex, Ety\Queue $queue, Ety\QueueLog $queueLog)
 {
     $message = 'Exception occured at file: ' . $ex->getFile() . ' on line: ' . $ex->getLine() . ' message: ' . $ex->getMessage();
     $queue->setStatus(self::STATUS_ERROR);
     $queueLog->setErrors($message);
     $this->_em->flush();
 }
 public function addTask($script, $parameters, $priority)
 {
     $queue = new Entity\Queue();
     $queue->setParameters(json_encode($parameters));
     $queue->setPriority($priority);
     $queue->setService($script);
     $queue->setStatus(self::STATUS_NEW);
     $em = $this->_doctrine->getManager();
     $em->persist($queue);
     $em->flush();
     return $queue;
 }