public function afterSave() { // parent for path and full url if ($this->isRoot()) { # path $path = $this->title; # full url $url = $this->url_part ? '/' . $this->url_part : $this->url_part; } else { $parents = $this->ancestors()->findAll(); // path $tmp = CHtml::listData($parents, 'id', 'title'); $tmp[] = $this->title; $path = implode(' → ', $tmp); // full url if (!empty($this->url_part)) { $tmp = CHtml::listData($parents, 'id', 'url_part'); $tmp[] = $this->url_part; $tmp = EArray::trimEmpty($tmp); $url = '/' . implode('/', $tmp); } else { $url = null; } } $this->updateByPk($this->id, array('path' => $path, 'url' => $url)); return parent::afterSave(); }