Commit ba7968cd authored by Shakarim Sapa's avatar Shakarim Sapa

- Валидатор модели триггеров приведен в порядок, теперь он проверяет...

- Валидатор модели триггеров приведен в порядок, теперь он проверяет полученный массив условий как положено;
parent cc0be225
...@@ -57,21 +57,14 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -57,21 +57,14 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
[['date_create'], 'safe'], [['date_create'], 'safe'],
[['name'], 'string', 'max' => 255], [['name'], 'string', 'max' => 255],
[['conditions'], function($attribute, $params) { [['conditions'], function($attribute, $params) {
$this->addError($attribute, 'asd'); if (!is_array($this->$attribute) || count($this->$attribute)===0) {
}], $this->addError($attribute, 'Conditions is empty or has a wrong format');
}
},'skipOnEmpty'=>false, 'skipOnError'=>false],
[['owner_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['owner_id' => 'id']], [['owner_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['owner_id' => 'id']],
]; ];
} }
// public function checkConditions($attribute, $params){
// var_dump('asd'); die;
// if (!is_array($this->$attribute) || count($this->$attribute)===0) {
// $this->addError($attribute, 'Conditions is empty or has a wrong format');
// return false;
// }
// return false;
// }
/** /**
* @inheritdoc * @inheritdoc
*/ */
......
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