<?php
/**
* DomainServiceValidator.class.php
*
* This file contains the definition of the DomainServiceValidator class.
*
* @package SolidWorks
* @author John Diamond <hide@address.com>
* @copyright John Diamond <hide@address.com>
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* DomainServiceValidator
*
* @package SolidWorks
* @author John Diamond <hide@address.com>
*/
class DomainServiceValidator extends FieldValidator {
/**
* Validate a Domain Service TLD
*
* Verifies that the domain service exists.
*
* @param string $data Field data
* @return DomainServiceDBO Domain Service DBO for this TLD
* @throws RecordNotFoundException
*/
public function validate( $data ) {
$data = parent::validate( $data );
try {
$domainDBO = load_DomainServiceDBO( $data );
}
catch ( DBNoRowsFoundException $e ) {
throw new RecordNotFoundException( "DomainService" );
}
if ( $this->fieldConfig['publicitemsonly'] && !$domainDBO->isPublic() ) {
throw new RecordNotFoundException( "DomainService" );
}
return $domainDBO;
}
}
?>