@@ 136-140 (lines=5) @@ | ||
133 | [['main_parent_id', 'created_by', 'updated_by', 'created_at', 'updated_at', 'status'], 'integer'], |
|
134 | [['parent_id'], function ($attribute, $params, $validator) { |
|
135 | $parent_id = CommentsHelper::decodeId($this->$attribute); |
|
136 | if ((!intval($parent_id)) || (!self::find()->where(['id' => $parent_id])->exists())) { |
|
137 | $this->addError( |
|
138 | $attribute, Yii::t('comments', 'Sorry, something went wrong. Please try again later.') |
|
139 | ); |
|
140 | } |
|
141 | }, 'on' => [ |
|
142 | self::SCENARIO_GUEST, |
|
143 | self::SCENARIO_USER |
@@ 104-108 (lines=5) @@ | ||
101 | $comment_id = CommentsHelper::decodeId($this->$attribute); |
|
102 | } |
|
103 | $commentClass = CommentsModule::getInstance()->commentModelClass; |
|
104 | if ((!intval($comment_id)) || (!$commentClass::find()->where(['id' => $comment_id])->exists())) { |
|
105 | $this->addError( |
|
106 | $attribute, Yii::t('comments', 'Sorry, something went wrong. Please try again later.') |
|
107 | ); |
|
108 | } |
|
109 | }], |
|
110 | [['ip'], 'ip'], |
|
111 | [['ip'], 'string', 'max' => 46] |