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

Reset groupby #71

Closed
riseoflex88 opened this issue May 21, 2018 · 2 comments
Closed

Reset groupby #71

riseoflex88 opened this issue May 21, 2018 · 2 comments
Assignees
Milestone

Comments

@riseoflex88
Copy link

Similar to this request: #31

I'd like to be able to reset the groupby setting, is this possible currently? if not, could it be added as a feature?

I'm building a class which uses latitude as the backbone, but it means I'm not certain what a user will add or remove from the query as it's being built. The groupby is set as a default, but it needs to be overwritten as required.

The other fields such as orderby were much simpler to see how to amend the latitude code to suggest a fix, but I can't see the same structure with orderby to make a suggestion on how to amend.

@shadowhand shadowhand added this to the 4.0.0 milestone May 21, 2018
@shadowhand shadowhand self-assigned this May 21, 2018
@shadowhand
Copy link
Owner

shadowhand commented May 21, 2018

It's not currently possible. This would work as an interim fix:

use Latitude\QueryBuilder\Query\SelectQuery;

\Closure::bind(function () {
    $this->groupBy = null;
}, $select, SelectQuery::class)();

http://php.net/manual/en/closure.bind.php

@riseoflex88
Copy link
Author

Oooh nice, worked perfectly thanks. Thanks for adding to 4.0.0 too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants