public function save(Pment_Models_Subcontract $subcontract) { $data = array( 'scontrId' => $subcontract->getScontrId(), 'projectId' => $subcontract->getProjectId(), 'scontrType' => $subcontract->getScontrType(), 'contractorId' => $subcontract->getContractorId(), 'content' => $subcontract->getContent(), 'detail' => $subcontract->getDetail(), 'quality' => $subcontract->getQuality(), 'startDateExp' => $subcontract->getStartDateExp(), 'endDateExp' => $subcontract->getEndDateExp(), 'startDateAct' => $subcontract->getStartDateAct(), 'endDateAct' => $subcontract->getEndDateAct(), 'brConContr' => $subcontract->getBrConContr(), 'brResContr' => $subcontract->getBrResContr(), 'brConSContr' => $subcontract->getBrConSContr(), 'brResSContr' => $subcontract->getBrResSContr(), 'contrAmt' => $subcontract->getContrAmt(), 'guarantee' => $subcontract->getGuarantee(), 'prjMargin' => $subcontract->getPrjMargin(), 'prjWarr' => $subcontract->getPrjWarr(), 'remark' => $subcontract->getRemark() ); if (null === ($id = $subcontract->getScontrId())) { unset($data['scontrId']); $this->getDbTable()->insert($data); } else { $this->getDbTable()->update($data, array('scontrId = ?' => $subcontract->getScontrId())); } }