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

		$result = parent::validate();

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

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

		// Allow extension customisation.

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

		$result = parent::validate();

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

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

		// Allow extension customisation.

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