public function actionUpdate($id) { if ($this->isPost) { $params = $this->request->post('User'); $res = $this->client->put('/user/{id}', $params, ['id' => $id]); if ($this->client->isValid) { return ''; } else { throw new UserError($this->client->errors); } } else { $res = $this->client->get('/user/{id}', ['id' => $id]); $model = new User(); $model->isNewRecord = false; $model->setAttributes($res, false); return $this->render('user_update', ['model' => $model]); } }