public function save(Pment_Models_Bhistory $bhistory) { $data = array( 'hiId' => $bhistory->getHiId(), 'planId' => $bhistory->getPlanId(), 'editDate' => $bhistory->getEditDate(), 'contactId' => $bhistory->getContactId(), 'status' => $bhistory->getStatus(), 'editType' => $bhistory->getEditType() ); if (null === ($id = $bhistory->getHiId())) { unset($data['hiId']); $id = $this->getDbTable()->insert($data); return $id; } else { $this->getDbTable()->update($data, array('hiId = ?' => $bhistory->getHiId())); } }