public function save(Vendor_Models_Vendor $vendor) { $data = array( 'vId' => $vendor->getVId(), 'name' => $vendor->getName(), 'contact' => $vendor->getContact(), 'typeId' => $vendor->getTypeId(), 'busiField' => $vendor->getBusiField(), 'phoneNo' => $vendor->getPhoneNo(), 'otherContact' => $vendor->getOtherContact(), 'address' => $vendor->getAddress(), 'remark' => $vendor->getRemark(), 'contactId' => $vendor->getContactId() ); if (null === ($id = $vendor->getVId())){ unset($data['vId']); $this->getDbTable()->insert($data); } else { $this->getDbTable()->update($data, array('vId = ?' => $vendor->getVId())); } }