コード例 #1
0
 public function actionCreate()
 {
     $form = new CreateCurrencyForm();
     $form->load(Yii::$app->request->post());
     $form->setUser($this->_user);
     if ($form->save()) {
         return ['status' => true, 'data' => $form->getCurrency()];
     }
     return ['status' => false, 'error' => ApiActiveRecord::ERROR_VALIDATION, 'error_code' => ApiActiveRecord::ERROR_VALIDATION, 'data' => $form->errors];
 }
コード例 #2
0
 /**
  * @return array
  */
 public function actionSignUp()
 {
     $form = new SignUpForm();
     $form->load(Yii::$app->request->post());
     if ($data = $form->signUp()) {
         $user = $form->getUser();
         CreateCategoryForm::createDefault($user);
         CreateCurrencyForm::createDefault($user);
         return ['status' => true, 'data' => $data];
     }
     return ['status' => false, 'error' => ApiActiveRecord::ERROR_VALIDATION, 'error_code' => ApiActiveRecord::ERROR_VALIDATION, 'data' => $form->errors];
 }