core/classes/DataModel.class.php
protected final function setError($key, $error = null){
        if($e = $this->getDefinitionValue($key,'error')){
            $error = $e;
        } else if($error === null){
            $error = sprintf($this->defaultErrorMessage,$key);
        }//elif
        $this->errors[$key] = $error;
        return false;
    }
protected final function setError($key, $error = null){
        if($e = $this->getDefinitionValue($key,'error')){
            $error = $e;
        } else if($error === null){
            $error = sprintf($this->defaultErrorMessage,$key);
        }//elif
        $this->errors[$key] = $error;
        return false;
    }
protected final function setError ( $ key , $ error = null ) { if ( $ e = $ this -> getDefinitionValue ( $ key , 'error' ) ) { $ error = $ e ; } else if ( $ error === null ) { $ error = sprintf ( $ this -> defaultErrorMessage , $ key ) ; } //elif $ this -> errors [ $ key ] = $ error ; return false ; }
Set an error.

@param string $key The data key.
@param null|string The error message to set, if null, the `defaultErrorMessage` will be used.

@return boolean Always returns false, which eases chaining in the `verifyData` method.
Set an error .