Commit b6b3d45b authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлена модель таблицы trigger_param

parent bac1971a
......@@ -82,6 +82,9 @@ class TriggerAdminController extends AdminController {
if ($model->load(Yii::$app->request->post())) {
$model->conditions = Yii::$app->request->post('Conditions');
$model->conditions = array_values($model->conditions);
var_dump($model->conditions);
die;
$datetime=new \DateTime();
$model->owner_id = Yii::$app->user->getId();
$model->date_create=$datetime->format('Y-m-d H:i:s');
......
<?php
namespace common\modules\triggers\models;
use Yii;
/**
* This is the model class for table "trigger_param".
*
* @property integer $id
* @property integer $condition_id
* @property string $key
* @property string $value
*
* @property TriggerCondition $condition
*/
class TriggerParam extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'trigger_param';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['condition_id'], 'required'],
[['condition_id'], 'integer'],
[['key', 'value'], 'string'],
[['condition_id'], 'exist', 'skipOnError' => true, 'targetClass' => TriggerCondition::className(), 'targetAttribute' => ['condition_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'condition_id' => 'Condition ID',
'key' => 'Key',
'value' => 'Value',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCondition()
{
return $this->hasOne(TriggerCondition::className(), ['id' => 'condition_id']);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment