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

Remove variables from src/DB.php or remove static. #3

Open
rjd22 opened this issue Sep 23, 2014 · 2 comments
Open

Remove variables from src/DB.php or remove static. #3

rjd22 opened this issue Sep 23, 2014 · 2 comments

Comments

@rjd22
Copy link

rjd22 commented Sep 23, 2014

In src/DB.php it is using static classes. This is not really wrong since they are returning classes instances so they are still injectable.

What should be changed is that they become true factories by removing the parameters from the static function unless it has something to do with the factory.

A different solution would be removing the statics so that you can just inject the DB class directly into a class. That way it will act a some kind of facade.

Since PHP 5.4 statics are not really useful anymore for their "nice" syntax. You can now do something like this: $select = (new Database)->select($params);

@shadowhand
Copy link
Contributor

Since PHP 5.4 statics are not really useful anymore for their "nice" syntax.

Doesn't work so well for query builders:

$query = (new Database_Query_Builder_Select); // vs
$query = DB::select();

@rjd22
Copy link
Author

rjd22 commented Nov 19, 2014

@shadowhand you I agree that DB::select() is a nicer syntax maybe we should do something like DB::query_builder()->select($prop) ?

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