Exemplo n.º 1
0
 public function refreshState()
 {
     $this->_job->refresh();
     $this->_fsm = unserialize($this->_job->sm);
     $this->_fsm->setOwner($this);
 }
Exemplo n.º 2
0
 /**
  * create a new Job and return the Job Info
  *
  * @param $params
  * @return RokCommon_Ajax_Result
  */
 public function createJob($params)
 {
     $result = new RokCommon_Ajax_Result();
     $tx = RokGallery_Doctrine::getConnection()->transaction;
     $tx->setIsolation('REPEATABLE READ');
     try {
         $tx->beginTransaction();
         $job = new RokGallery_Model_Job();
         $job->id = RokCommon_UUID::generate();
         $job->type = RokGallery_Model_Job::TYPE_UPLOAD;
         $job->state = RokGallery_Model_Job::STATE_PENDING;
         $job->percent = 0;
         $job->save();
         $result->setPayload(array('job' => $job->id));
         $tx->commit();
     } catch (Exception $e) {
         $tx->rollback();
         throw $e;
     }
     return $result;
 }