示例#1
0
 public function actionValidate($id = '')
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     if (!Yii::$app->request->isAjax) {
         return false;
     }
     $model = null;
     if (empty($id)) {
         $model = static::getIdentityNewModel(Email::className());
     } else {
         $model = Email::findByIdentity()->id($id)->one();
     }
     if (!$model) {
         return false;
     }
     /* @var $model Email */
     $model->scenario = Email::SCENARIO_FORM;
     if ($model->load(Yii::$app->request->post())) {
         return ActiveForm::validate($model);
     }
     return false;
 }
示例#2
0
 /**
  * 
  * @return BaseUserItemQuery
  */
 public function getEmails()
 {
     $model = Email::buildNoInitModel();
     return $this->hasMany(Email::className(), [$model->createdByAttribute => $this->guidAttribute])->inverseOf('user');
 }
示例#3
0
 /**
  * Get list of contacts.
  */
 public function actionList()
 {
     return static::getList(Email::className());
 }