src/wcmf/lib/persistence/impl/DefaultPersistentObject.php
protected function validateValueAgainstValidateType($name, $value) {
    // don't validate referenced values
    $mapper = $this->getMapper();
    if ($mapper->hasAttribute($name) && $mapper->getAttribute($name) instanceof ReferenceDescription) {
      return;
    }
    $validateType = $this->getValueProperty($name, 'validate_type');
    if (($validateType == '' || Validator::validate($value, $validateType,
            ['entity' => $this, 'value' => $name]))) {
      return;
    }
    // construct the error message
    $messageInstance = ObjectFactory::getInstance('message');
    $validateDescription = $this->getValueProperty($name, 'validate_description');
    if (strlen($validateDescription) > 0) {
      // use configured message if existing
      $errorMessage = $messageInstance->getText($validateDescription);
    }
    else {
      // default text
      $errorMessage = $messageInstance->getText("The value of '%0%' (%1%) is invalid.", [$messageInstance->getText($name), $value]);
    }
    throw new ValidationException($name, $value, $errorMessage);
  }
protected function validateValueAgainstValidateType($name, $value) {
    // don't validate referenced values
    $mapper = $this->getMapper();
    if ($mapper->hasAttribute($name) && $mapper->getAttribute($name) instanceof ReferenceDescription) {
      return;
    }
    $validateType = $this->getValueProperty($name, 'validate_type');
    if (($validateType == '' || Validator::validate($value, $validateType,
            ['entity' => $this, 'value' => $name]))) {
      return;
    }
    // construct the error message
    $messageInstance = ObjectFactory::getInstance('message');
    $validateDescription = $this->getValueProperty($name, 'validate_description');
    if (strlen($validateDescription) > 0) {
      // use configured message if existing
      $errorMessage = $messageInstance->getText($validateDescription);
    }
    else {
      // default text
      $errorMessage = $messageInstance->getText("The value of '%0%' (%1%) is invalid.", [$messageInstance->getText($name), $value]);
    }
    throw new ValidationException($name, $value, $errorMessage);
  }
protected function validateValueAgainstValidateType ( $ name , $ value ) { // don't validate referenced values $ mapper = $ this -> getMapper ( ) ; if ( $ mapper -> hasAttribute ( $ name ) && $ mapper -> getAttribute ( $ name ) instanceof ReferenceDescription ) { return ; } $ validateType = $ this -> getValueProperty ( $ name , 'validate_type' ) ; if ( ( $ validateType == '' || Validator :: validate ( $ value , $ validateType , [ 'entity' => $ this , 'value' => $ name ] ) ) ) { return ; } // construct the error message $ messageInstance = ObjectFactory :: getInstance ( 'message' ) ; $ validateDescription = $ this -> getValueProperty ( $ name , 'validate_description' ) ; if ( strlen ( $ validateDescription ) > 0 ) { // use configured message if existing $ errorMessage = $ messageInstance -> getText ( $ validateDescription ) ; } else { // default text $ errorMessage = $ messageInstance -> getText ( "The value of '%0%' (%1%) is invalid." , [ $ messageInstance -> getText ( $ name ) , $ value ] ) ; } throw new ValidationException ( $ name , $ value , $ errorMessage ) ; }
Check a value's value against the validation type set on it. This method uses the
validateType property of the attribute definition.
Throws a ValidationException if the value is not valid.
@param $name The name of the item to set.
@param $value The value of the item.
Check a value s value against the validation type set on it . This method uses the validateType property of the attribute definition . Throws a ValidationException if the value is not valid .