/** * * @return array */ public function updateAction() { $params = $this->getRequest()->getParams(); if ($this->getRequest()->isPost()) { $id = $this->getRequest()->getParam('id_freight_type'); $freightType = FreightTypeQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the FreightType with id {$id}")); try { $this->getFreightTypeCatalog()->beginTransaction(); FreightTypeFactory::populate($freightType, $params); $this->getFreightTypeCatalog()->update($freightType); $this->getFreightTypeCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("The Freight Type with id {$id} was created")); } catch (Exception $e) { $this->getFreightTypeCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('freight-type/list'); }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\FreightType */ protected function makeBean($resultset) { return FreightTypeFactory::createFromArray($resultset); }