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

Allow reset for some query parts #84

Closed
golgote opened this issue Feb 23, 2016 · 9 comments
Closed

Allow reset for some query parts #84

golgote opened this issue Feb 23, 2016 · 9 comments

Comments

@golgote
Copy link

golgote commented Feb 23, 2016

What about:
public function orderBy(array $spec, $replace = false)
instead of : public function orderBy(array $spec)

This can be added to other clauses as well.
I personally need this because my query is built by different objects and each adds some clauses that might later need to be replaced by others.

@harikt
Copy link
Member

harikt commented Feb 23, 2016

How about send a PR and in case @pmjones finds the time he can merge if that is ok :-) .

@golgote
Copy link
Author

golgote commented Feb 23, 2016

OK I will do that ASAP. I was just checking if you were open to this change.
Thanks.

@yespire
Copy link
Contributor

yespire commented May 7, 2016

Which syntax is better:
1.
single reset() method handle all cases
query->reset() // -- all, paramter is mixed optional
query->reset('order_by') // -- single factor
query->reset(['order_by', 'cols'] // -- multi-factors

a set of specialized reset methods
query->reset() // -- all, no parameter
query->resetCols() // -- no parameter
query->resetOrderBy()

support both 1 + 2

@harikt
Copy link
Member

harikt commented May 7, 2016

PR #91 .

@pmjones
Copy link
Member

pmjones commented May 19, 2016

There are now 2 PRs in for this issue: #91 and #94. I will pick one of them, or implement the functionality myself. Thanks for your patience!

@pmjones
Copy link
Member

pmjones commented May 19, 2016

@golgote @yespire @gauthier @harikt --

I am considering a series of without*() methods that return a clone of the current query. E.g.:

$newQuery = $oldQuery->withoutWhere()->withoutCols()->withoutOrderBy();

That way the existing query continues to exist, and the new one can be independently modified.

Thoughts?

@pmjones
Copy link
Member

pmjones commented May 19, 2016

No, on further consideration, we already have some reset*() methods that can be exposed without BC break. I'll expand on those instead. If the user wants a clone, they can clone.

@harikt
Copy link
Member

harikt commented May 20, 2016

@pmjones FYI in case if you missed the discussion on #91 (comment) .

@pmjones
Copy link
Member

pmjones commented Sep 2, 2016

Addressed by #95 et al. Let me know if those do not server your purposes.

@pmjones pmjones closed this as completed Sep 2, 2016
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

4 participants