Commit 47bd5adef95576647b483d704bba078b21f36043

Authored by Yarik
1 parent 71ad29c4

test

common/models/Project.php
... ... @@ -162,7 +162,7 @@
162 162 'boolean',
163 163 ],
164 164 [
165   - [ 'hidden' ],
  165 + [ 'hidden', 'budget', 'total_budget' ],
166 166 'default',
167 167 'value' => 0,
168 168 ],
... ...
common/modules/comment/models/Comment.php
... ... @@ -310,7 +310,7 @@
310 310 'model' => $this->className(),
311 311 ])
312 312 ->one();
313   - if(!$rating instanceof \common\modules\comment\models\Rating && !$this->isNewRecord) {
  313 + if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) {
314 314 $rating = new \common\modules\comment\models\Rating([
315 315 'model' => $this->className(),
316 316 'model_id' => $this->comment_id,
... ...
common/modules/comment/widgets/CommentWidget.php
... ... @@ -225,8 +225,11 @@
225 225 {
226 226 $data = \Yii::$app->request->post();
227 227 if($this->comment_class->load($data) && $this->comment_class->postComment()) {
228   - if(is_object($this->rating_class) && $this->comment_class->rating->load($data) && $this->comment_class->rating->save()) {
229   - $this->isSuccess = true;
  228 + if(is_object($this->rating_class)) {
  229 + $this->comment_class->checkRating();
  230 + if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) {
  231 + $this->isSuccess = true;
  232 + }
230 233 }
231 234 }
232 235 }
... ...