diff --git a/common/models/Project.php b/common/models/Project.php index e44c7bc..ec0ce81 100644 --- a/common/models/Project.php +++ b/common/models/Project.php @@ -162,7 +162,7 @@ 'boolean', ], [ - [ 'hidden' ], + [ 'hidden', 'budget', 'total_budget' ], 'default', 'value' => 0, ], diff --git a/common/modules/comment/models/Comment.php b/common/modules/comment/models/Comment.php index 28d847e..69a0f19 100644 --- a/common/modules/comment/models/Comment.php +++ b/common/modules/comment/models/Comment.php @@ -310,7 +310,7 @@ 'model' => $this->className(), ]) ->one(); - if(!$rating instanceof \common\modules\comment\models\Rating && !$this->isNewRecord) { + if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) { $rating = new \common\modules\comment\models\Rating([ 'model' => $this->className(), 'model_id' => $this->comment_id, diff --git a/common/modules/comment/widgets/CommentWidget.php b/common/modules/comment/widgets/CommentWidget.php index 41b8ccd..9c9dd6e 100644 --- a/common/modules/comment/widgets/CommentWidget.php +++ b/common/modules/comment/widgets/CommentWidget.php @@ -225,8 +225,11 @@ { $data = \Yii::$app->request->post(); if($this->comment_class->load($data) && $this->comment_class->postComment()) { - if(is_object($this->rating_class) && $this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { - $this->isSuccess = true; + if(is_object($this->rating_class)) { + $this->comment_class->checkRating(); + if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { + $this->isSuccess = true; + } } } } -- libgit2 0.21.4