public function generateName() { $lastTree = $this->find()->orderBy(["id" => SORT_DESC])->one(); $this->setAttribute("name", "pk-" . $lastTree->primaryKey); return $this; }