public function save(Vehicle_Models_Mtnc $mtnc) { $data = array( 'mtnId' => $mtnc->getMtnId(), 'veId' => $mtnc->getVeId(), 'rDate' => $mtnc->getRDate(), 'detail' => $mtnc->getDetail(), 'contactId' => $mtnc->getContactId(), 'mile' => $mtnc->getMile(), 'amount' => $mtnc->getAmount(), 'remark' => $mtnc->getRemark() ); if (null === ($id = $mtnc->getMtnId())) { unset($data['mtnId']); $this->getDbTable()->insert($data); } else { $this->getDbTable()->update($data, array('mtnId = ?' => $mtnc->getMtnId())); } }