Accounts: Add account detail page
This commit is contained in:
parent
985f46c652
commit
4e8d879008
8 changed files with 182 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace MailAccountAdmin\Repositories;
|
||||
|
||||
use MailAccountAdmin\Exceptions\AccountNotFoundException;
|
||||
use PDO;
|
||||
|
||||
class AccountRepository extends BaseRepository
|
||||
|
|
@ -32,4 +33,16 @@ class AccountRepository extends BaseRepository
|
|||
$statement->execute($queryParams);
|
||||
return $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function fetchAccountById(int $accountId): array
|
||||
{
|
||||
$statement = $this->pdo->prepare('SELECT * FROM mail_users WHERE user_id = :user_id LIMIT 1');
|
||||
$statement->execute(['user_id' => $accountId]);
|
||||
|
||||
if ($statement->rowCount() < 1) {
|
||||
throw new AccountNotFoundException("Account with user ID '$accountId' was not found.");
|
||||
}
|
||||
|
||||
return $statement->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue