8000 Fix sortBy in DataProviderRepositoryTrait by luca-rath · Pull Request #6619 · sulu/sulu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix sortBy in DataProviderRepositoryTrait #6619

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

Merged

Conversation

luca-rath
Copy link
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets -
Related issues/PRs -
License MIT
Documentation PR -

What's in this PR?

Fix sortBy in DataProviderRepositoryTrait

@luca-rath luca-rath added the Bug Error or unexpected behavior of already existing functionality label May 23, 2022
if (strpos($sortColumn, '.') === false) {
$sortColumn = 'c.' . $sortColumn;
}

$queryBuilder->addSelect($sortColumn);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addSelect() throws an error if the column doesn't contain an alias while addOrderBy() allows the column to not have an alias

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, this is not true 🤦 The appendSortBy() method was overridden in the project, therefore it worked

@wachterjohannes wachterjohannes merged commit fb47744 into sulu:1.6 May 23, 2022
@luca-rath luca-rath deleted the bugfix/data-provider-repository-trait branch May 23, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0