|
|
@@ -102,9 +102,9 @@ class Category extends Backend
|
|
|
$params = $this->preExcludeFields($params);
|
|
|
|
|
|
if ($params['pid'] != $row['pid']) {
|
|
|
- $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id']);
|
|
|
+ $childrenIds = Tree::instance()->init(collection(\app\common\model\Category::select())->toArray())->getChildrenIds($row['id'], true);
|
|
|
if (in_array($params['pid'], $childrenIds)) {
|
|
|
- $this->error(__('Can not change the parent to child'));
|
|
|
+ $this->error(__('Can not change the parent to child or itself'));
|
|
|
}
|
|
|
}
|
|
|
|