public getUsernameByApiKey ( string $apiKey ) : string | ||
$apiKey | string | userId |
return | string |
public function getUsernameByApiKey($apiKey)
{
$user = $this->findOneBy(['apiKey' => $apiKey]);
if (!$user) {
return;
}
return $user->getUsername();
}