pdo->prepare($query); $statement->execute($queryParams); $rows = $statement->fetchAll(PDO::FETCH_ASSOC); // Create Account models from rows $accountList = []; foreach ($rows as $row) { $accountList[] = Account::createFromArray($row); } return $accountList; } public function fetchAccountById(int $accountId): Account { $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."); } $row = $statement->fetch(PDO::FETCH_ASSOC); return Account::createFromArray($row); } }