Skip to content
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

Ensure order by overrides global scope #37647

Closed
wants to merge 2 commits into from
Closed

Ensure order by overrides global scope #37647

wants to merge 2 commits into from

Conversation

spawnia
Copy link
Contributor

@spawnia spawnia commented Jun 10, 2021

This test shows the behaviour of applying an order by clause that conflicts with a global scope.
Prior to #37582, the overriden order by clause had precedence. Now, only the clause from the global scope is applied.

This behavioural change broke our application and I believe it should be fixed.

@driesvints
Copy link
Member

Please note that your PR won't be reviewed when it's in draft. Tests are also failing it seems.

@spawnia
Copy link
Contributor Author

spawnia commented Jun 10, 2021

Tests are also failing it seems.

That's the point of this PR. I skipped right past creating an issue and went straight to providing a failing test case.

@driesvints driesvints marked this pull request as ready for review June 10, 2021 15:20
@spawnia
Copy link
Contributor Author

spawnia commented Jun 10, 2021

Here is the test output with #37582 reverted:

1) Illuminate\Tests\Database\DatabaseEloquentGlobalScopesTest::testOrderByOverridesGlobalScope
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'select * from "table" order by "name" desc'
+'select * from "table" order by "name" desc, "name" asc'

/home/bfranke/projects/laravel-framework/tests/Database/DatabaseEloquentGlobalScopesTest.php:45

As you can see, the order by clause is duplicated - but the latter has precedence!

@taylorotwell
Copy link
Member

Reverted that entire PR.

@spawnia spawnia deleted the order-by-overrides-global-scope branch June 11, 2021 07:12
Javdu10 added a commit to Javdu10/framework that referenced this pull request Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants