Example #1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\RestockEntry
  */
 protected function makeBean($resultset)
 {
     return RestockEntryFactory::createFromArray($resultset);
 }
Example #2
0
 public function updateRestockEntryAction()
 {
     if ($this->getRequest()->isPost()) {
         $restockEntries = $this->getRequest()->getParam("restock_entry");
         $this->getRestockCatalog()->beginTransaction();
         try {
             foreach ($restockEntries as $restockEntryArray) {
                 if ($restockEntryArray["checked"]) {
                     $restockEntry = RestockEntryQuery::create()->findByPKOrElse($restockEntryArray['id_restock_entry'], new RestockEntry());
                     RestockEntryFactory::populate($restockEntry, $restockEntryArray);
                     $this->getRestockEntryCatalog()->update($restockEntry);
                 }
             }
             $this->getRestockCatalog()->commit();
             $result = true;
             $message = $this->i18n->_("The Restock was updated");
         } catch (Exception $e) {
             $this->getRestockCatalog()->rollBack();
             $result = false;
             $message = $this->i18n->_($e->getMessage());
         }
     } else {
         $result = false;
     }
     die(Zend_Json::encode(array("result" => $result, "message" => $message)));
 }