add new getters to userrepository
This commit is contained in:
parent
2de0589762
commit
1c38049735
@ -22,6 +22,23 @@ class UserRepository implements IUserRepository
|
|||||||
return \Container::$persistentDataManager->selectFromDb($select, User::class);
|
return \Container::$persistentDataManager->selectFromDb($select, User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getByUsername(string $username): ?User
|
||||||
|
{
|
||||||
|
$select = new Select(\Container::$dbConnection);
|
||||||
|
$select->where('username', '=', $username);
|
||||||
|
|
||||||
|
return \Container::$persistentDataManager->selectFromDb($select, User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByEmailOrUsername(string $emailOrUsername): ?User
|
||||||
|
{
|
||||||
|
if (filter_var($emailOrUsername, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
return $this->getByEmail($emailOrUsername);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getByUsername($emailOrUsername);
|
||||||
|
}
|
||||||
|
|
||||||
public function getByGoogleSub(string $sub): ?User
|
public function getByGoogleSub(string $sub): ?User
|
||||||
{
|
{
|
||||||
$select = new Select(\Container::$dbConnection);
|
$select = new Select(\Container::$dbConnection);
|
||||||
|
Loading…
Reference in New Issue
Block a user