From 171e60e9c2a7f1b6c348ad2bc955c339ef2f71fb Mon Sep 17 00:00:00 2001 From: Arne De Smedt Date: Thu, 31 Aug 2023 17:23:29 +0200 Subject: [PATCH] Order based on the document id --- src/OrderBy/PostgresOrderByProcessor.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/OrderBy/PostgresOrderByProcessor.php b/src/OrderBy/PostgresOrderByProcessor.php index 4d6ef4e..9d61738 100644 --- a/src/OrderBy/PostgresOrderByProcessor.php +++ b/src/OrderBy/PostgresOrderByProcessor.php @@ -42,6 +42,12 @@ private function processOrderBy(OrderBy $orderBy): array return ["$sortA, $sortB", array_merge($sortAArgs, $sortBArgs)]; } + if ($orderBy instanceof DocumentStore\OrderBy\DocId) { + $direction = $orderBy->direction(); + + return ["id $direction", []]; + } + /** @var DocumentStore\OrderBy\Asc|DocumentStore\OrderBy\Desc $orderBy */ $direction = $orderBy instanceof DocumentStore\OrderBy\Asc ? 'ASC' : 'DESC'; $prop = $this->propToJsonPath($orderBy->prop());