From 277ef0beb228505dd5028f3ba27b0804bc70e1a2 Mon Sep 17 00:00:00 2001 From: Sasha Rybkin Date: Mon, 26 Apr 2021 17:23:35 +0300 Subject: [PATCH] fix --- models/MoleTask.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/models/MoleTask.php b/models/MoleTask.php index 2dcafc8..4adea46 100644 --- a/models/MoleTask.php +++ b/models/MoleTask.php @@ -126,6 +126,14 @@ class MoleTask extends \yii\db\ActiveRecord */ public static function add($controller, $name, $params = array(), $priority = 0, $period = 0, $dateAdd = false, $project = false) { + $module = ''; + if(stripos($model->controller, '.')) + { + $arController = explode('.', $controller); + $module = $arController[0]; + $controller = $arController[1]; + } + $model = new MoleTask(); $model->controller = $controller; $model->name = $name; @@ -134,7 +142,8 @@ class MoleTask extends \yii\db\ActiveRecord $model->period = $period; $model->dateAdd = $dateAdd ?: date('Y-m-d H:i:s'); $model->project = $project ?: Yii::$app->getModule('cron')->project; - $model->type = stripos($model->controller, '.') ? $model->controller : ($model->project . '.' . $model->controller); // для совместимости + $model->module = $module; + $model->type = stripos($controller, '.') ? $controller : ($model->project . '.' . $model->controller); // для совместимости return $model->save(); }