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 for overwriting of query segements #2

Closed
nrwiersma opened this issue Jan 10, 2017 · 5 comments
Closed

Allow for overwriting of query segements #2

nrwiersma opened this issue Jan 10, 2017 · 5 comments

Comments

@nrwiersma
Copy link

Hey,

Came across a use case that, while maybe possible, is probably not great. I am busy building large query objects, and in an inheritance case, I want to overwrite the selects. I do understand that this is a little bit of an edge case. It would good however to have select and addSelect which will allow for this. select would overwrite the selects and addSelect would append.

Later.

@adambanaszkiewicz
Copy link
Owner

Maybe select() method should be same as is, but add method replaceSelect(). IMO basic methods should be as simple as possible, and methods that came outside the basic functionality can have more complicated names, because these methods will be used rare, and developers to use them almost always came to DOC to read how do this.

Also, You can always write Your own QueryBuilder and QueryBuilderFactory and extends this code, and add methods that You need, in the way you need. There is realy more to extends, this code is open for modifications by extending :)

@nrwiersma
Copy link
Author

The other option is to use default parameters, like an $overwrite = false parameter.

I hear you though, I am not opposed to inheriting, especially cause this is an edge case.

You are welcome to close this issue.

@adambanaszkiewicz
Copy link
Owner

Can You describe little this idea with parameter?

@nrwiersma
Copy link
Author

Just looked at the code again, it wouldn't work because select is using func_get_args(). Your method would be better in this case.

@adambanaszkiewicz
Copy link
Owner

I add remove*() methods, that allows to remove each query segment, like:

removeSelects(), removeWheres(), removeLimit(), etc.

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

No branches or pull requests

2 participants