getUsername() public method

Technically, this method will look for the user's backend account (or, if authenticationProviderName is specified, for the account matching the given authentication provider) and return the account's identifier.
public getUsername ( User $user, string $authenticationProviderName = null ) : string
$user Neos\Neos\Domain\Model\User
$authenticationProviderName string
return string The username or null if the given user does not have a backend account
コード例 #1
0
 /**
  * Returns the name of the currently logged in user's personal workspace (even if that might not exist at that time).
  * If no user is logged in this method returns null.
  *
  * @return string
  * @api
  */
 public function getPersonalWorkspaceName()
 {
     $currentUser = $this->userDomainService->getCurrentUser();
     if (!$currentUser instanceof User) {
         return null;
     }
     $username = $this->userDomainService->getUsername($currentUser);
     return $username === null ? null : UserUtility::getPersonalWorkspaceNameForUsername($username);
 }