getId() public method

public getId ( ) : mixed
return mixed
Exemplo n.º 1
0
 /**
  * @param AbstractJob $job
  *
  * @return bool
  * @throws \Cronario\Exception\JobException
  */
 public function save(AbstractJob $job)
 {
     $data = $job->getData();
     if (!$job->isStored()) {
         $job->setId(uniqid());
     }
     $this->redis->set($this->namespace . $job->getId(), json_encode($data));
     return true;
 }
Exemplo n.º 2
0
 /**
  * @param AbstractJob $parentJob
  *
  * @return ResultException|null
  */
 public function __invoke(AbstractJob $parentJob = null)
 {
     if (null !== $parentJob) {
         $this->setParentId($parentJob->getId())->setAuthor($parentJob->getAuthor());
     }
     $this->save();
     try {
         if ($this->isSync()) {
             $worker = AbstractWorker::factory($this->getWorkerClass());
             $worker($this);
         } else {
             $this->setResult(new ResultException(ResultException::R_QUEUED));
             $this->putIntoQueue();
             $this->save();
         }
     } catch (\Exception $ex) {
         $this->setResult($ex);
         $this->save();
     }
     return $this->getResult();
 }