Skip to content

Commit

Permalink
Merge pull request #767 from DMKEBUSINESSGMBH/master
Browse files Browse the repository at this point in the history
[BUGFIX] make order by deterministic
  • Loading branch information
lochmueller authored Oct 13, 2023
2 parents c19d063 + 1b3e4c2 commit 5b0b34f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Classes/Domain/Repository/IndexRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class IndexRepository extends AbstractRepository
protected $defaultOrderings = [
'start_date' => QueryInterface::ORDER_ASCENDING,
'start_time' => QueryInterface::ORDER_ASCENDING,
'uid' => QueryInterface::ORDER_ASCENDING,
];

/**
Expand Down Expand Up @@ -99,11 +100,13 @@ public function findAllForBackend(
$query->setOrderings([
'start_date' => QueryInterface::ORDER_ASCENDING,
'start_time' => QueryInterface::ORDER_ASCENDING,
'uid' => QueryInterface::ORDER_ASCENDING,
]);
} else {
$query->setOrderings([
'start_date' => QueryInterface::ORDER_DESCENDING,
'start_time' => QueryInterface::ORDER_DESCENDING,
'uid' => QueryInterface::ORDER_DESCENDING,
]);
}

Expand Down Expand Up @@ -674,6 +677,7 @@ protected function getSorting(string $direction, string $field = ''): array
'endDate' => $direction,
'startDate' => $direction,
'startTime' => $direction,
'uid' => $direction,
];
}
if ('end' !== $field) {
Expand All @@ -683,6 +687,7 @@ protected function getSorting(string $direction, string $field = ''): array
return [
$field . 'Date' => $direction,
$field . 'Time' => $direction,
'uid' => $direction,
];
}
}
1 change: 1 addition & 0 deletions Classes/Domain/Repository/RawIndexRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function findEventsAfterStartDate(
)
->addOrderBy('start_date', 'ASC')
->addOrderBy('start_time', 'ASC')
->addOrderBy('uid', 'ASC')
->setMaxResults($limit);

$result = $queryBuilder->executeQuery()->fetchAllAssociative();
Expand Down

0 comments on commit 5b0b34f

Please sign in to comment.