/** * * @return array */ public function createAction() { if ($this->getRequest()->isPost()) { $params = $this->getRequest()->getParams(); try { $this->getFreightTypeCatalog()->beginTransaction(); $freightType = FreightTypeFactory::createFromArray($params); $freightType->setStatus(FreightType::$Status['Active']); $this->getFreightTypeCatalog()->create($freightType); $this->getFreightTypeCatalog()->commit(); $id = $freightType->getIdFreightType(); $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); }