/**
  *
  * @return array
  */
 public function updateAction()
 {
     $form = $this->getForm();
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         if (!$form->isValid($params)) {
             $this->view->setTpl("New");
             $this->view->form = $form;
             return;
         }
         $id = $this->getRequest()->getParam('id');
         $accessRole = AccessRoleQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the AccessRole with id {$id}"));
         try {
             $this->getAccessRoleCatalog()->beginTransaction();
             AccessRoleFactory::populate($accessRole, $form->getValues());
             $this->getAccessRoleCatalog()->update($accessRole);
             $this->getAccessRoleCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se actualizo correctamente el AccessRole"));
         } catch (Exception $e) {
             $this->getAccessRoleCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('access-role/list');
 }
Exemple #2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\AccessRole
  */
 protected function makeBean($resultset)
 {
     return AccessRoleFactory::createFromArray($resultset);
 }