/** * * @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'); $currency = CurrencyQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Currency with id {$id}")); try { $this->getCurrencyCatalog()->beginTransaction(); CurrencyFactory::populate($currency, $form->getValues()); $this->getCurrencyCatalog()->update($currency); $this->getCurrencyCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("Se actualizo correctamente el Currency")); } catch (Exception $e) { $this->getCurrencyCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('currency/list'); }