models/UserUsernameTrait.php
public function createUsername($username)
    {
        if (!$this->hasEnabledUsername()) {
            return null;
        }
        $usernameClass = $this->usernameClass;
        $model = $usernameClass::findOne($this->getGUID());
        if (!$model) {
            $model = $this->create($usernameClass);
            $model->setGUID($this->getGUID());
        }
        $model->content = $username;
        return $model;
    }
public function createUsername($username)
    {
        if (!$this->hasEnabledUsername()) {
            return null;
        }
        $usernameClass = $this->usernameClass;
        $model = $usernameClass::findOne($this->getGUID());
        if (!$model) {
            $model = $this->create($usernameClass);
            $model->setGUID($this->getGUID());
        }
        $model->content = $username;
        return $model;
    }
public function createUsername ( $ username ) { if ( ! $ this -> hasEnabledUsername ( ) ) { return null ; } $ usernameClass = $ this -> usernameClass ; $ model = $ usernameClass :: findOne ( $ this -> getGUID ( ) ) ; if ( ! $ model ) { $ model = $ this -> create ( $ usernameClass ) ; $ model -> setGUID ( $ this -> getGUID ( ) ) ; } $ model -> content = $ username ; return $ model ; }
Create or get username.
@param $username
@return null|Username
Create or get username .