-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SQL Issue with multiple orderBy('order') #4985
Conversation
Fixing SQL Issue: A column has been specified more than once in the order by list. Columns in the order by list must be unique. Just had this issue on a MsSQL server. Whenever the menu items should be shown, I was facing the error from above. And I figured out, that there is indeed the `orderBy('order')` applied multiple times: Once in `Menu::display()` and the other time in the relationship itself, on `MenuItem::children`. Since I think it makes somehow sense to sort the MenuItems per default, I decided to remove the `orderBy` in the `Menu::display` method. But this MR is just to share the awareness of the issue, so feel free to do something else to fix the issue 😉 Have a great day! 😁
Codecov Report
@@ Coverage Diff @@
## 1.4 #4985 +/- ##
============================================
- Coverage 62.91% 62.90% -0.01%
Complexity 1374 1374
============================================
Files 194 194
Lines 4010 4009 -1
============================================
- Hits 2523 2522 -1
Misses 1487 1487
Continue to review full report at Codecov.
|
Is this going to be merged or will it be fixed somewhere else? |
I think the order should be applied in |
Either way, It's probably gonna take some time until it's merged so feel free to update it meanwhile. |
Where is that second ordering tho? Edit: Nevermind. In the model. |
awesome, thx 👍 |
Fixing SQL Issue: A column has been specified more than once in the order by list. Columns in the order by list must be unique.
Just had this issue on a MsSQL server. Whenever the menu items should be shown, I was facing the error from above. And I figured out, that there is indeed the
orderBy('order')
applied multiple times: Once inMenu::display()
and the other time in the relationship itself, onMenuItem::children
.Since I think it makes somehow sense to sort the MenuItems per default, I decided to remove the
orderBy
in theMenu::display
method. But this MR is just to share the awareness of the issue, so feel free to do something else to fix the issue 😉Have a great day! 😁