Esempio n. 1
0
File: Model.php Progetto: rj28/test
 public function execute(Console $console)
 {
     $this->getWriteConnection()->execute("\n\t\t\tupdate {$this->getSource()} set executed_at = ? where cron_job_id = ?\n\t\t", [$this->executed_at = date("Y-m-d H:i:s"), $this->cron_job_id]);
     try {
         $console->handle(array('task' => $this->task_name, 'action' => $this->action_name));
         $this->save(['last_message' => '', 'completed_at' => date('Y-m-d H:i:s'), 'locked_till' => time() + $this->delay]);
         Assert::saved($this);
         return static::RESULT_OK;
     } catch (Exception $e) {
         $this->getLogger()->exception($e);
         $this->save(['last_message' => get_class($e) . ': ' . $e->getMessage(), 'completed_at' => null, 'locked_till' => time() + $this->delay]);
         return static::RESULT_ERR;
     }
 }