Commit 372ac585 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлена модель (TriggerCondition) таблицы отвечающей за условия срабатывания триггера;

- Обновлена модель TriggerTrigger, в связи с появлением новой связи HAS_MANY
parent 01337758
<?php
namespace common\modules\triggers\models;
use Yii;
/**
* This is the model class for table "trigger_condition".
*
* @property integer $id
* @property integer $group_number
* @property integer $trigger_id
*
* @property TriggerTrigger $trigger
*/
class TriggerCondition extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'trigger_condition';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['group_number', 'trigger_id'], 'required'],
[['group_number', 'trigger_id'], 'integer'],
[['trigger_id'], 'exist', 'skipOnError' => true, 'targetClass' => TriggerTrigger::className(), 'targetAttribute' => ['trigger_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'group_number' => 'Group Number',
'trigger_id' => 'Trigger ID',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getTrigger()
{
return $this->hasOne(TriggerTrigger::className(), ['id' => 'trigger_id']);
}
}
......@@ -17,6 +17,7 @@ use common\modules\users\models\User;
* @property integer $timeout
* @property integer $message_template_id
*
* @property TriggerCondition[] $triggerConditions
* @property TriggerConnection[] $triggerConnections
* @property User $owner
*/
......@@ -62,6 +63,14 @@ class TriggerTrigger extends \yii\db\ActiveRecord
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getTriggerConditions()
{
return $this->hasMany(TriggerCondition::className(), ['trigger_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
......
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