-
Notifications
You must be signed in to change notification settings - Fork 170
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
[3.x/4.x]: Emails::_createEmailQuery (and others) could be explicit about the orderBy #3263
Comments
Add the table alias to the `orderBy` to avoid driver specific ambiguity in the generated SQL when joining against another table that _also_ has a `name` column. This is in line with `States::_createStatesQuery`, and should fix craftcms#3263.
Add the table alias to the `orderBy` to avoid driver specific ambiguity in the generated SQL when joining against another table that _also_ has a `name` column. This is in line with `States::_createStatesQuery`, and should fix craftcms#3263.
Thanks @lukeholder for the quick merge! I took a guess at your dev process; unsure if there also needs to be a PR based off the |
Hey @lukeholder, are you planning on including the PR for this in a 3.x release? |
Hi @msbit Thank you for reporting this to us and adding the PRs to solve it! Just wanted to update you to let you know that the fix made it into Thanks again! |
What happened?
A slightly curly one, but in my test suite (running on SQLite in memory, you don't see this on MySQL) calling
\craft\commerce\services\Emails::getAllEmailsByOrderStatusId
fails with the following:This boils down to calling:
without specifying the table (like so):
at:
https://github.com/craftcms/commerce/blob/3.4.22.1/src/services/Emails.php#L913
https://github.com/craftcms/commerce/blob/4.2.11/src/services/Emails.php#L894
when used in scenarios where a join against a table which also has a
name
column (such ascommerce_orderstatuses
in this case).It seems like it would be a good idea (and help out my specific case :D) to provide the table alias to the
orderBy
call here (and perhaps anywhere else like this).Craft CMS version
3.8.9
Craft Commerce version
3.4.21
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: