Commit 620d6ab
authored
Fix compiling queries that use orderByRaw with expressions (#57228)
* Fix compiling queries that use orderByRaw with expressions
This fixes an issue caused by the removal of automatic casting of Expression objects to strings in Laravel 10.
$sql = DB::table('users')
->select('id')
->orderByRaw(DB::raw('length(name) desc'))
->toSql();
fails without this change.
* Update src/Illuminate/Database/Query/Grammars/Grammar.php
* Add tests for compileOrders method in Grammar1 parent 214005f commit 620d6ab
File tree
2 files changed
+41
-1
lines changed- src/Illuminate/Database/Query/Grammars
- tests/Database
2 files changed
+41
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
990 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
991 | 995 | | |
992 | 996 | | |
993 | 997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
45 | 81 | | |
0 commit comments