Sort aliases by wildcard priority first
This commit is contained in:
parent
6400962a44
commit
2f20e9d474
|
|
@ -11,11 +11,11 @@ class AliasRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
public function fetchAliasesForUserId(int $userId): array
|
public function fetchAliasesForUserId(int $userId): array
|
||||||
{
|
{
|
||||||
$statement = $this->pdo->prepare('SELECT * FROM mail_aliases WHERE user_id = :user_id ORDER BY mail_address');
|
$statement = $this->pdo->prepare('SELECT * FROM mail_aliases WHERE user_id = :user_id ORDER BY wildcard_priority, mail_address');
|
||||||
$statement->execute(['user_id' => $userId]);
|
$statement->execute(['user_id' => $userId]);
|
||||||
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Create Account models from rows
|
// Create Alias models from rows
|
||||||
$aliasList = [];
|
$aliasList = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$aliasList[] = Alias::createFromArray($row);
|
$aliasList[] = Alias::createFromArray($row);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue