/** * Add job to current queue * * @param \Comodojo\Extender\Job\Job $job An instance of \Comodojo\Extender\Job\Job * * @return string A job unique identifier */ public final function addJob(\Comodojo\Extender\Job\Job $job) { $uid = self::getJobUid(); try { $class = $job->getClass(); if (class_exists($class) === false) { throw new Exception("Task cannot be loaded"); } $this->jobs[$uid] = array("name" => $job->getName(), "id" => $job->getId(), "parameters" => $job->getParameters(), "task" => $job->getTask(), "class" => $class); } catch (Exception $e) { $this->logger->error('Error including job', array("JOBUID" => $uid, "ERROR" => $e->getMessage(), "ERRID" => $e->getCode())); return false; } return $uid; }