/** * Validate a Hosting Service Purchase ID * * Verifies that the server exists. * * @param array $config Field configuration * @param string $data Field data * @return HostingServicePurchaseDBO Purchase DBO for this HostingServicePurchase ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $purchaseDBO = load_HostingServicePurchaseDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("HostingPurchase"); } // Verify that this purchase is for a specific account if (isset($this->accountID) && $purchaseDBO->getAccountID() != $this->accountID) { throw new FieldException("Purchase/Account mismatch"); } return $purchaseDBO; }
/** * Set Purchase ID * * Assign this IP Address to a hosting service purchase * * @param integer $id HostingServicePurchaseID */ function setPurchaseID($id) { $id = intval($id); if ($id < 1) { // Not assigned to a purchase unset($this->purchaseid); unset($this->purchasedbo); return; } // Load HostingServicePurchaseDBO $this->purchasedbo = load_HostingServicePurchaseDBO($id); $this->purchaseid = $id; }