public function setUsername($username = null)
    {
        if ($username === null && ($model = $this->getUsername()->one())) {
            return $model->delete() > 0;
        }
        if ($username instanceof Username) {
            $username = $username->content;
        }
        $model = $this->createUsername($username);
        return $model->save();
    }
public function setUsername($username = null)
    {
        if ($username === null && ($model = $this->getUsername()->one())) {
            return $model->delete() > 0;
        }
        if ($username instanceof Username) {
            $username = $username->content;
        }
        $model = $this->createUsername($username);
        return $model->save();
    }
public function setUsername ( $ username = null ) { if ( $ username === null && ( $ model = $ this -> getUsername ( ) -> one ( ) ) ) { return $ model -> delete ( ) > 0 ; } if ( $ username instanceof Username ) { $ username = $ username -> content ; } $ model = $ this -> createUsername ( $ username ) ; return $ model -> save ( ) ; }
Set username.
@param string|Username $username
@return bool
Set username .