protected function afterSave() { parent::afterSave(); if ($this->isNewRecord) { $menu = Menumanage::model()->findByPk($this->term_id); $menu->saveCounters(array('count' => '1'), array('condition' => "term_id = :term_id"), array(':term_id' => $this->term_id)); } }