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(Phone::className());
     } else {
         $model = Phone::findByIdentity()->id($id)->one();
     }
     if (!$model) {
         return false;
     }
     /* @var $model Phone */
     $model->scenario = Phone::SCENARIO_FORM;
     if ($model->load(Yii::$app->request->post())) {
         return ActiveForm::validate($model);
     }
     return false;
 }
Beispiel #2
0
 /**
  * 
  * @return BaseUserItemQuery
  */
 public function getPhones()
 {
     $model = Phone::buildNoInitModel();
     return $this->hasMany(Phone::className(), [$model->createdByAttribute => $this->guidAttribute])->inverseOf('user');
 }
 /**
  * Get list of contacts.
  */
 public function actionList()
 {
     return static::getList(Phone::className());
 }