File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1366,6 +1366,20 @@ public function resetQueryPart($queryPartName)
1366
1366
return $ this ;
1367
1367
}
1368
1368
1369
+ /**
1370
+ * Resets the ordering for the query.
1371
+ *
1372
+ * @return $this This QueryBuilder instance.
1373
+ */
1374
+ public function resetOrderBy (): self
1375
+ {
1376
+ $ this ->sqlParts ['orderBy ' ] = self ::SQL_PARTS_DEFAULTS ['orderBy ' ];
1377
+
1378
+ $ this ->state = self ::STATE_DIRTY ;
1379
+
1380
+ return $ this ;
1381
+ }
1382
+
1369
1383
/** @throws QueryException */
1370
1384
private function getSQLForSelect (): string
1371
1385
{
Original file line number Diff line number Diff line change @@ -631,6 +631,17 @@ public function testResetQueryParts(): void
631
631
self ::assertEquals ('SELECT u.* FROM users u ' , (string ) $ qb );
632
632
}
633
633
634
+ public function testResetOrderBy (): void
635
+ {
636
+ $ qb = new QueryBuilder ($ this ->conn );
637
+
638
+ $ qb ->select ('u.* ' )->from ('users ' , 'u ' )->orderBy ('u.name ' );
639
+
640
+ self ::assertEquals ('SELECT u.* FROM users u ORDER BY u.name ASC ' , (string ) $ qb );
641
+ $ qb ->resetOrderBy ();
642
+ self ::assertEquals ('SELECT u.* FROM users u ' , (string ) $ qb );
643
+ }
644
+
634
645
public function testCreateNamedParameter (): void
635
646
{
636
647
$ qb = new QueryBuilder ($ this ->conn );
You can’t perform that action at this time.
0 commit comments