示例#1
0
 /**
  *
  * @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');
 }
示例#2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\FreightType
  */
 protected function makeBean($resultset)
 {
     return FreightTypeFactory::createFromArray($resultset);
 }