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