Exemplo n.º 1
0
 public function save(Application_Model_Product $model)
 {
     $return = 0;
     $data = array('ID' => $model->getId(), 'name' => $model->getName(), 'description' => $model->getDescription(), 'productNo' => $model->getProductNo(), 'quantity' => $model->getQuantity(), 'sellingprice' => $model->getSellingprice(), 'costprice' => $model->getCostprice());
     if (null === ($id = $model->getId())) {
         unset($data['ID']);
         $return = $this->getDbTable()->insert($data);
     } else {
         $return = $this->getDbTable()->update($data, array('ID=?' => $id));
     }
     return $return;
 }