Exemple #1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\Currency
  */
 protected function makeBean($resultset)
 {
     return CurrencyFactory::createFromArray($resultset);
 }
 /**
  *
  * @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->getCurrencyCatalog()->beginTransaction();
             $currency = CurrencyFactory::createFromArray($form->getValues());
             $this->getCurrencyCatalog()->create($currency);
             $this->getCurrencyCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se ha guardado correctamente el "));
         } catch (Exception $e) {
             $this->getCurrencyCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('currency/list');
 }