Exemplo n.º 1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\PurchaseOrderFolio
  */
 protected function makeBean($resultset)
 {
     return PurchaseOrderFolioFactory::createFromArray($resultset);
 }
 /**
  *
  * @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');
         $purchaseOrderFolio = PurchaseOrderFolioQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the PurchaseOrderFolio with id {$id}"));
         try {
             $this->getPurchaseOrderFolioCatalog()->beginTransaction();
             PurchaseOrderFolioFactory::populate($purchaseOrderFolio, $form->getValues());
             $this->getPurchaseOrderFolioCatalog()->update($purchaseOrderFolio);
             $this->getPurchaseOrderFolioCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se actualizo correctamente el PurchaseOrderFolio"));
         } catch (Exception $e) {
             $this->getPurchaseOrderFolioCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('purchase-order-folio/list');
 }