protected function afterSave() { parent::afterSave(); $this->id = Yii::app()->db->getLastInsertId(); }