Sulu\Bundle\SecurityBundle\Entity\UserRepository::getUsernameByApiKey PHP Méthode

getUsernameByApiKey() public méthode

returns username for given apiKey.
public getUsernameByApiKey ( string $apiKey ) : string
$apiKey string userId
Résultat string
    public function getUsernameByApiKey($apiKey)
    {
        $user = $this->findOneBy(['apiKey' => $apiKey]);
        if (!$user) {
            return;
        }
        return $user->getUsername();
    }