public function getMailUrl($action) { $userAction = new UserAction(); $userAction->user_id = $this->id; $userAction->action = $action; $userAction->date = time(); $userAction->code = $userAction->generateCode(); $userAction->save(); switch ($action) { default: $url = Yii::app()->createUrl('/site/' . $action, array('c' => $userAction->code)); break; } return Yii::app()->request->getBaseUrl(true) . $url; }