Esempio n. 1
0
 public function editAccountAction()
 {
     $account = $this->authenticationService->getIdentity();
     $id = $account->getId();
     $resultModel = new JsonResultModel();
     if ($this->getRequest()->isPost()) {
         try {
             $dataJson = $this->params()->fromPost('account');
             $account = Json::decode($dataJson);
             $this->accountService->editAccount($id, $account->name);
         } catch (ValidationException $ve) {
             return $resultModel->setErrors($ve->getValidationError());
         } catch (\Exception $e) {
             return $resultModel->addErrors('error', 'unknow error');
         }
         return $resultModel;
     }
     return array('account' => $account);
 }