Conditions | 3 |
Paths | 1 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function init() |
||
13 | { |
||
14 | parent::init(); |
||
15 | Yii::$app->queue->on(Queue::EVENT_AFTER_PUSH, function ($event) { |
||
16 | $delay=$event->delay>=0 ?$event->delay : 0; |
||
17 | $queue = new QueueDb(); |
||
18 | $queue->name=$this->getName(); |
||
|
|||
19 | $queue->catalog=$this->getCatalog(); |
||
20 | $queue->description=$this->getDescription(); |
||
21 | $queue->exec_time=$delay + time(); |
||
22 | $queue->queue_id=$event->id; |
||
23 | $queue->save(); |
||
24 | }); |
||
25 | //增加错误日志 |
||
26 | Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function (ErrorEvent $event) { |
||
27 | if ($event->job instanceof \graychen\yii2\queue\backend\jobs\ BaseObject) { |
||
28 | $model = Queue::findOne(['queue_id'=>$event->id]); |
||
29 | $model->log = $event->error; |
||
30 | $model->save(); |
||
31 | } |
||
32 | }); |
||
33 | } |
||
34 | |||
50 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.