Skip to content

Commit 2083417

Browse files
author
igor-chepurnoi
committed
fix #75
1 parent ee7e92e commit 2083417

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ install:
1818

1919
script:
2020
- vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff
21-
- phpunit --verbose
21+
- vendor/bin/phpunit --verbose

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"paulzi/yii2-adjacency-list": "^2.0"
2727
},
2828
"require-dev": {
29-
"friendsofphp/php-cs-fixer": "~2.0"
29+
"friendsofphp/php-cs-fixer": "~2.0",
30+
"phpunit/phpunit": "~6.0"
3031
},
3132
"autoload": {
3233
"psr-4": {

models/CommentModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function find()
168168
public function beforeSave($insert)
169169
{
170170
if (parent::beforeSave($insert)) {
171-
if ($this->parentId > 0) {
171+
if ($this->parentId > 0 && $this->isNewRecord) {
172172
$parentNodeLevel = static::find()->select('level')->where(['id' => $this->parentId])->scalar();
173173
$this->level += $parentNodeLevel;
174174
}

0 commit comments

Comments
 (0)