protected function validateAlias()
    {
        $field = 'alias';
        $value = $this->getSubmitted($field);

        if (empty($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Alias');

        if (mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label, 0, 255);
            return false;
        }

        if (preg_match('/^[A-Za-z0-9_.-]+$/', $value) !== 1) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $updating = $this->getUpdating();

        if (isset($updating['alias']) && $updating['alias'] === $value) {
            return true; // Do not check own alias on update
        }

        if ($this->alias->exists($value)) {
            $this->setErrorExists($field, $label);
            return false;
        }

        return true;
    }
protected function validateAlias()
    {
        $field = 'alias';
        $value = $this->getSubmitted($field);

        if (empty($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Alias');

        if (mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label, 0, 255);
            return false;
        }

        if (preg_match('/^[A-Za-z0-9_.-]+$/', $value) !== 1) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $updating = $this->getUpdating();

        if (isset($updating['alias']) && $updating['alias'] === $value) {
            return true; // Do not check own alias on update
        }

        if ($this->alias->exists($value)) {
            $this->setErrorExists($field, $label);
            return false;
        }

        return true;
    }
protected function validateAlias ( ) { $ field = 'alias' ; $ value = $ this -> getSubmitted ( $ field ) ; if ( empty ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Alias' ) ; if ( mb_strlen ( $ value ) > 255 ) { $ this -> setErrorLengthRange ( $ field , $ label , 0 , 255 ) ; return false ; } if ( preg_match ( '/^[A-Za-z0-9_.-]+$/' , $ value ) !== 1 ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ updating = $ this -> getUpdating ( ) ; if ( isset ( $ updating [ 'alias' ] ) && $ updating [ 'alias' ] === $ value ) { return true ; // Do not check own alias on update } if ( $ this -> alias -> exists ( $ value ) ) { $ this -> setErrorExists ( $ field , $ label ) ; return false ; } return true ; }
Validates an alias
@return boolean|null
Validates an alias