Refactor of the hacky Database class #31
Labels
No labels
bug
dependency
documentation
feature
invalid
refactor
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
vlw/scaffold#31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
Databaseclass is in dire need of a refactor. We should not be relying on$_ENVvariables to create a new connection, and we definitely should not use the stupid "set_credentials()" method we added to bypass it. It's ugly, and leaks connections like a bitch.We need something that uses THE SAME connection (same instance of my
MySQLlibrary) instead of creating a new one every damn time.The primary reason why we can't just pass the constructor arguments along to the parent class are all of the
new Database()statements that we use inDatabase\Model. Here for example:codeberg.org/vlw/scaffold@71a9f12b02/src/Database/Model.php (L45)We create a new connection for each of these, we should use an existing connection instead.