skeeks\cms\models\Tree::processNormalize PHP Method

processNormalize() public method

Если найти всех рутов дерева и запустить этот метод, то дерево починиться в случае поломки правильно переустановятся все dir, pids и т.д.
public processNormalize ( )
    public function processNormalize()
    {
        //Если это новая несохраненная сущьность, ничего делать не надо
        if ($this->isNewRecord) {
            return $this;
        }
        if (!$this->pid) {
            $this->setAttribute("dir", null);
            $this->save(false);
        } else {
            $this->setAttributesForFutureParent($this->parent);
            $this->save(false);
        }
        //Берем детей на один уровень ниже
        if ($this->children) {
            $this->save(false);
            foreach ($this->children as $childModel) {
                $childModel->processNormalize();
            }
        }
        return $this;
    }