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

Adopt the stellarwp/db library (version 1.1.0) #5

Merged
merged 9 commits into from
Oct 6, 2022

Conversation

borkweb
Copy link
Member

@borkweb borkweb commented Aug 28, 2022

This changeset adopts the stellarwp/db library and uses it for database operations.

  • Added stellarwp/db as a dependency.
  • Swapped out direct $wpdb calls with the DB class.
  • Added some tests for index checking on tables.

Addresses: #7

@borkweb borkweb requested a review from JasonTheAdams August 28, 2022 05:49
@borkweb borkweb marked this pull request as ready for review August 28, 2022 05:49
@borkweb borkweb changed the base branch from main to 1.1.0 August 28, 2022 13:34
@borkweb borkweb requested review from bordoni and lucatume August 28, 2022 13:46
* @see https://github.com/BrianHenryIE/strauss
*/

$aliases = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class_alias function will pre-load the aliased classes when you call it. Not an issue in this specific application, but something to note/share when eager-loading of the classes is not a desirable side effect. The solution to keep lazy-loading aliased classes is to do so in an autoload function.

borkweb added a commit that referenced this pull request Sep 15, 2022
This PR builds on top of the original PR (#5) to add the DB library into the mix. Within you will find:

1. Removal of the `di52` library. Instead, `StellarWP\Schema\Config::set_container( $container )` must be used.
1. I've refactored some of the `di52`-specific features (service providers, `getVar`/`setVar`, etc ) to be more friendly to other containers that implement the core `singleton()`, `make()`, and `bind()` methods.
1. I've removed the `stellarwp/db` as an included library. Instead, the project that uses `stellarwp/schema` should inject the `DB::class` via `StellarWP\Schema\Config::set_db( DB::class )`

Note: I imagine further iterations on this code will be needed before we merge it fully.
@borkweb borkweb marked this pull request as draft September 15, 2022 03:50
@borkweb borkweb added the invalid This doesn't seem right label Sep 15, 2022
@borkweb borkweb merged commit cd3e24b into 1.1.0 Oct 6, 2022
@borkweb borkweb deleted the feature/add-db-library branch October 7, 2022 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants