You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Wrong query when using scopeWhereTranslation() with $locale parameter
To Reproduce $application->whereTranslation('published_at', Carbon::now(), 'en', 'whereHas', '<=');
Expected behavior
current query is:
select * from applications where exists (select * from application_translations where applications.id = application_translations.application_id and application_translations.published_at <= ? and application_translations.locale <= ?);
expected query is:
select * from applications where exists (select * from application_translations where applications.id = application_translations.application_id and application_translations.published_at <= ? and application_translations.locale = ?);
The problem is
when $locale parameter passed it uses $operator parameter for building query for locale (application_translations.locale <= ?), should use '=' for locale operator in any case.
Versions (please complete the following information)
Describe the bug
Wrong query when using scopeWhereTranslation() with $locale parameter
To Reproduce
$application->whereTranslation('published_at', Carbon::now(), 'en', 'whereHas', '<=');
Expected behavior
current query is:
select * from
applications
where exists (select * fromapplication_translations
whereapplications
.id
=application_translations
.application_id
andapplication_translations
.published_at
<= ? andapplication_translations
.locale
<= ?);expected query is:
select * from
applications
where exists (select * fromapplication_translations
whereapplications
.id
=application_translations
.application_id
andapplication_translations
.published_at
<= ? andapplication_translations
.locale
= ?);The problem is
when $locale parameter passed it uses $operator parameter for building query for locale (
application_translations
.locale
<= ?), should use '=' for locale operator in any case.Versions (please complete the following information)
Additional context
File: src/Translatable/Traits/Scopes.php
Line: 93
Method:
I assume this method should look like this:
The text was updated successfully, but these errors were encountered: