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

[RFC] Deprecate some alias functions in DatabaseQuery #174

Open
HLeithner opened this issue Jul 4, 2019 · 4 comments
Open

[RFC] Deprecate some alias functions in DatabaseQuery #174

HLeithner opened this issue Jul 4, 2019 · 4 comments

Comments

@HLeithner
Copy link
Contributor

In the CMS we moved our method calls from join('left') to leftJoin() I'm not sure if this really makes sense because it's only a alias function to join() so we have small overhead.

Also it makes the API more complex and less maintainable.
Most of the functions are not in the interface which seams to make a problem in IntelliJ IDE so if
we don't remove them they should be in the interface.

Functions for discussion:
[]Join functions
[
]where functions

Functions missing in the interface
dateAdd
dateFormat
dump
escape (and alias)
quote (and alias)
quoteName (and alias)
format

Is there a reason why these functions are not in the interface?

@mbabker
Copy link
Contributor

mbabker commented Jul 4, 2019

escape(), quote(), and quoteName() are intended to be done through the database driver primarily, I honestly don't know why they were added to the query class in the first place but they are all proxies to the driver so I didn't think they needed to be on the query interface (put them in one spot and leave it be). Looks like dateFormat() is also a proxy. The dump() method I'd just deprecate, it doesn't do anything useful on its own. So dateAdd() and format() are probably just oversights.

The where and join shortcuts, personally I'm not a fan of littering interfaces with shortcut methods, which is why none of the interfaces have e(), q(), qn(), *Join(), orWhere(), and andWhere() methods.

@HLeithner
Copy link
Contributor Author

Because we touch "every" query in the CMS we should do something soon.
Maybe some input from @alikon and @wilsonge ?

btw. would it make sense to change the interface PreparableInterface return value of bind to $this the same why like in the other interfaces?

@mbabker
Copy link
Contributor

mbabker commented Jul 4, 2019

btw. would it make sense to change the interface PreparableInterface return value of bind to $this the same why like in the other interfaces?

Yeah. Probably just missed it in one of the times I went over that stuff and replaced explicit names with $this.

@alikon
Copy link
Contributor

alikon commented Jul 9, 2019

not a big fan of changing something because of IDE (Intellij or whatever)
the alias like e(), q(), qn(), leftJoin() can be deprecated as well

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

3 participants