@@ -1696,9 +1696,9 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
16961696 $ hasIdAttribute = false ;
16971697 foreach ($ orderAttributes as $ i => $ attribute ) {
16981698 $ originalAttribute = $ attribute ;
1699+
16991700 $ attribute = $ this ->getInternalKeyForAttribute ($ attribute );
17001701 $ attribute = $ this ->filter ($ attribute );
1701-
17021702 if (\in_array ($ attribute , ['_uid ' , '_id ' ])) {
17031703 $ hasIdAttribute = true ;
17041704 }
@@ -1723,23 +1723,21 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
17231723 );
17241724 }
17251725
1726- $ alias = $ this ->quote ($ alias );
1727- $ attribute = $ this ->quote ($ attribute );
17281726 $ binds [':cursor ' ] = $ cursor [$ originalAttribute ];
17291727
17301728 $ where [] = "(
1731- {$ alias }. {$ attribute } {$ this ->getSQLOperator ($ orderMethod )} :cursor
1729+ {$ this -> quote ( $ alias) }. {$ this -> quote ( $ attribute) } {$ this ->getSQLOperator ($ orderMethod )} :cursor
17321730 OR (
1733- {$ alias }. {$ attribute } = :cursor
1731+ {$ this -> quote ( $ alias) }. {$ this -> quote ( $ attribute) } = :cursor
17341732 AND
1735- {$ alias }._id {$ this ->getSQLOperator ($ orderMethodInternalId )} {$ cursor ['$internalId ' ]}
1733+ {$ this -> quote ( $ alias) }._id {$ this ->getSQLOperator ($ orderMethodInternalId )} {$ cursor ['$internalId ' ]}
17361734 )
17371735 ) " ;
17381736 } elseif ($ cursorDirection === Database::CURSOR_BEFORE ) {
17391737 $ orderType = $ orderType === Database::ORDER_ASC ? Database::ORDER_DESC : Database::ORDER_ASC ;
17401738 }
17411739
1742- $ orders [] = "{$ attribute } {$ orderType }" ;
1740+ $ orders [] = "{$ this -> quote ( $ attribute) } {$ orderType }" ;
17431741 }
17441742
17451743 // Allow after pagination without any order
0 commit comments