src/objects/MediaType.php
public function validate() {

		$result = parent::validate();

		// Confirm that the current type has been given a title and doesn't already exist.

		if($result->isValid() && !$this->Title) {
			$result->addError('"Title" required!');
		}
		else if($result->isValid() && MediaType::get_one(MediaType::class, array(
			'ID != ?' => $this->ID,
			'Title = ?' => $this->Title
		))) {
			$result->addError('Type already exists!');
		}

		// Allow extension customisation.

		$this->extend('validateMediaType', $result);
		return $result;
	}
public function validate() {

		$result = parent::validate();

		// Confirm that the current type has been given a title and doesn't already exist.

		if($result->isValid() && !$this->Title) {
			$result->addError('"Title" required!');
		}
		else if($result->isValid() && MediaType::get_one(MediaType::class, array(
			'ID != ?' => $this->ID,
			'Title = ?' => $this->Title
		))) {
			$result->addError('Type already exists!');
		}

		// Allow extension customisation.

		$this->extend('validateMediaType', $result);
		return $result;
	}
public function validate ( ) { $ result = parent :: validate ( ) ; // Confirm that the current type has been given a title and doesn't already exist. if ( $ result -> isValid ( ) && ! $ this -> Title ) { $ result -> addError ( '"Title" required!' ) ; } else if ( $ result -> isValid ( ) && MediaType :: get_one ( MediaType :: class , array ( 'ID != ?' => $ this -> ID , 'Title = ?' => $ this -> Title ) ) ) { $ result -> addError ( 'Type already exists!' ) ; } // Allow extension customisation. $ this -> extend ( 'validateMediaType' , $ result ) ; return $ result ; }
Confirm that the current type is valid.
Confirm that the current type is valid .