Commit 663225ff authored by Shakarim Sapa's avatar Shakarim Sapa

- Изменен родительский класс, добавлены некоторые обязательные условия

parent 742ca28a
...@@ -13,8 +13,9 @@ use Yii; ...@@ -13,8 +13,9 @@ use Yii;
* @property integer $condition_id * @property integer $condition_id
* *
* @property TriggerTrigger $trigger * @property TriggerTrigger $trigger
* @property TriggerParam[] $triggerParams
*/ */
class TriggerCondition extends \yii\db\ActiveRecord class TriggerCondition extends \common\components\ActiveRecordModel
{ {
/** /**
* @inheritdoc * @inheritdoc
...@@ -24,18 +25,27 @@ class TriggerCondition extends \yii\db\ActiveRecord ...@@ -24,18 +25,27 @@ class TriggerCondition extends \yii\db\ActiveRecord
return 'trigger_condition'; return 'trigger_condition';
} }
public function name()
{
return 'Условия триггера';
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function rules() public function rules()
{ {
return [ return [
[['group_number', 'trigger_id, condition_id'], 'required'], [['group_number', 'trigger_id', 'condition_id'], 'required'],
[['group_number', 'trigger_id, condition_id'], 'integer'], [['group_number', 'trigger_id', 'condition_id'], 'integer'],
[['trigger_id'], 'exist', 'skipOnError' => true, 'targetClass' => TriggerTrigger::className(), 'targetAttribute' => ['trigger_id' => 'id']], [['trigger_id'], 'exist', 'skipOnError' => true, 'targetClass' => TriggerTrigger::className(), 'targetAttribute' => ['trigger_id' => 'id']],
]; ];
} }
public function behaviors(){
return [];
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -56,4 +66,12 @@ class TriggerCondition extends \yii\db\ActiveRecord ...@@ -56,4 +66,12 @@ class TriggerCondition extends \yii\db\ActiveRecord
{ {
return $this->hasOne(TriggerTrigger::className(), ['id' => 'trigger_id']); return $this->hasOne(TriggerTrigger::className(), ['id' => 'trigger_id']);
} }
/**
* @return \yii\db\ActiveQuery
*/
public function getTriggerParams()
{
return $this->hasMany(TriggerParam::className(), ['condition_id' => '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