Esempio n. 1
0
 /**
  *
  * @return array
  */
 public function createAction()
 {
     $form = $this->getForm();
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         if (!$form->isValid($params)) {
             $this->view->setTpl("New");
             $this->view->form = $form;
             return;
         }
         try {
             $this->getAccessRoleCatalog()->beginTransaction();
             $accessRole = AccessRoleFactory::createFromArray($form->getValues());
             $this->getAccessRoleCatalog()->create($accessRole);
             $this->getAccessRoleCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se ha guardado correctamente el "));
         } catch (Exception $e) {
             $this->getAccessRoleCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('access-role/list');
 }
Esempio n. 2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\AccessRole
  */
 protected function makeBean($resultset)
 {
     return AccessRoleFactory::createFromArray($resultset);
 }