1515 * @property string $status
1616 * @property string $messages
1717 * @property string $dateCreated
18- * @property string $dateScheduled
19- * @property string $dateExecuted
2018 * @property string $dateFinished
2119 */
2220class CronScheduleModel extends ActiveRecord
2321{
24-
2522 /**
26- * Declares the name of the database table associated with this AR class.
27- * @return string the table name
23+ * @inheritdoc
2824 */
2925 public static function tableName ()
3026 {
3127 return '{{%CronSchedule}} ' ;
3228 }
3329
3430 /**
35- * Returns the validation rules for attributes.
36- * @return array validation rules
31+ * @inheritdoc
3732 */
3833 public function rules ()
3934 {
4035 return [
41- [['messages ' ], 'string ' ],
42- [['dateCreated ' , 'dateScheduled ' , 'dateExecuted ' , 'dateFinished ' ], 'safe ' ],
43- [['jobCode ' ], 'string ' , 'max ' => 255 ],
36+ ['messages ' , 'string ' ],
37+ ['jobCode ' , 'string ' , 'max ' => 255 ],
4438 ['status ' , 'integer ' ],
39+ [['dateCreated ' , 'dateFinished ' ], 'safe ' ],
4540 ];
4641 }
4742
4843 /**
49- * Returns the attribute labels.
50- * @return array attribute labels (name => label)
44+ * @inheritdoc
5145 */
5246 public function attributeLabels ()
5347 {
5448 return [
55- 'id ' => Yii::t ('cron ' , 'ID ' ),
56- 'jobCode ' => Yii::t ('cron ' , 'Job Code ' ),
57- 'status ' => Yii::t ('cron ' , 'Status ' ),
58- 'messages ' => Yii::t ('cron ' , 'Messages ' ),
59- 'dateCreated ' => Yii::t ('cron ' , 'Date Created ' ),
60- 'dateScheduled ' => Yii::t ('cron ' , 'Date Scheduled ' ),
61- 'dateExecuted ' => Yii::t ('cron ' , 'Date Executed ' ),
62- 'dateFinished ' => Yii::t ('cron ' , 'Date Finished ' ),
49+ 'id ' => Yii::t ('yii2mod-cron-log ' , 'ID ' ),
50+ 'jobCode ' => Yii::t ('yii2mod-cron-log ' , 'Job Code ' ),
51+ 'status ' => Yii::t ('yii2mod-cron-log ' , 'Status ' ),
52+ 'messages ' => Yii::t ('yii2mod-cron-log ' , 'Messages ' ),
53+ 'dateCreated ' => Yii::t ('yii2mod-cron-log ' , 'Date Created ' ),
54+ 'dateFinished ' => Yii::t ('yii2mod-cron-log ' , 'Date Finished ' ),
6355 ];
6456 }
6557
66-
6758 /**
6859 * Start cron schedule
6960 *
@@ -77,8 +68,7 @@ public function startCronSchedule($jobCode, $status = CronScheduleStatus::RUN, $
7768 $ this ->jobCode = $ jobCode ;
7869 $ this ->status = $ status ;
7970 $ this ->messages = $ messages ;
80- $ this ->dateScheduled = new Expression ('NOW() ' );
81- $ this ->dateExecuted = new Expression ('NOW() ' );
71+ $ this ->dateCreated = new Expression ('NOW() ' );
8272
8373 return $ this ->save ();
8474 }
@@ -97,11 +87,10 @@ public function endCronSchedule($status, $messages = null)
9787 $ this ->dateFinished = new Expression ('NOW() ' );
9888 $ this ->status = $ status ;
9989 $ this ->messages = $ messages ;
90+
10091 return $ this ->save ();
10192 }
93+
10294 return false ;
10395 }
104- }
105-
106-
107-
96+ }
0 commit comments