order user jobs alphabetically when returning all active user jobs

This commit is contained in:
2024-02-26 13:36:44 +01:00
parent d713087dcb
commit bbb167bb85
8 changed files with 24 additions and 10 deletions

View File

@@ -40,7 +40,11 @@ readonly class UserJobRepository implements UserJobRepositoryInterface
public function findAllActive(): array
{
return $this->repository->findBy(['active' => true]);
$jobs = $this->repository->findBy(['active' => true]);
usort($jobs, fn (UserJob $a, UserJob $b) => $this->translatableStringHelper->localize($a->getLabel()) <=> $this->translatableStringHelper->localize($b->getLabel()));
return $jobs;
}
public function findAllOrderedByName(): array