-
Notifications
You must be signed in to change notification settings - Fork 475
-
Notifications
You must be signed in to change notification settings - Fork 475
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
3.0 Queries: Base query class (meta, dates, caching) #6331
Comments
Add |
Added. |
@JJJ looks like |
Copy/pasta. Fixed. |
Adjust `EDD_DB_Order_Query` to be a subclass of this new class, and define the database columns in a new helper class: `EDD_DB_Column`. `EDD_DB_Column` might be temporary, or not really necessary, but it did help me structure and scaffold much of the automation that's happening now. See #6331.
Crud; I included a file that was part of a different stash, so I'm gonna clean that up quick. |
OK, here's where this is at now:
|
* Do not allow direct instanation of core objects; only the query class can instantiate objects. * All protected properties can no longer be directly accessed. A getter is required. * See #6331
We'll use this to automatically set the datetime value when an item is modified. See #6331.
This commit simplifies some column logic, removes a few class properties, adds a `get_column_field()` method, and automatically saves created and modified times when adding & updating items. See #6331.
This will eventually use Carbon (or a utility function) but it's easy to use `gmtime()` to get going. See #6331.
These were previously public while we determined the class properties. See #6331.
This prevents the saving of unknown fields, and avoids needing to blacklist fields like nonces & referrers. See #6331.
Closing out as this has been completed. Any bugs found during alpha/beta testing should be opened as new issues. |
Tracking issue: #4576
Pull request: #6333
TL;DR
Transition Payments/Discounts/Logs/Notes/Orders/Order-Items post-types to custom component database tables, most paired with meta. Architect a traditional WordPress query interface that's simple and DRY for all of them to maintain developer happiness.
Summary
One technical challenge for EDD3 is the introduction of approximately 12 new database tables (for a total of 14.) The reason for this move is to ultimately provide a more scalable application without a requirement for third-party horizontal scaling techniques (multiple servers; WordPress drop-in plugins; cache/db/lb/web/etc...)
By scaling the databases horizontally by default, EDD can better control the flow of data internally without compromising performance. Put another way, by not storing everything as a custom post type & post-meta, EDD can avoid hurting the performance of other post-type related data, while also improving its own efficiency.
It's a win-win for everyone, but with a hidden caveat...
We learned first-hand (via BuddyPress and Multisite) that the above approach works well-enough at providing a stable foundation for scaling a complex WordPress application, but we also learned having more than a half-dozen different interfaces for interacting with new & unique components in WordPress is a hugely negative experience for traditional WordPress developers.
Each new component/meta relationship is a new hurdle to jump, and too many hurdles leaves developers exhausted and unhappy.
I'm proposing (and working on) a mostly-magic base query-class for all custom database tables to extend, that will automatically make every new table queryable using the same basic parameters, provide object caching for those individual items, without compromising either application performance or developer joy.
Kinda like an ORM, but without the need to relearn the WordPress way of querying for things.
How does it work?
Components
Here is the master list of components, alphabetically. Each will get checked when complete:
Orders (Previously Payments)
Table/schema completed (see #6277)
Query vars
id
id__in
id__not_on
number
number__in
number__not_in
status
status__in
status__not_in
user_id
user__in
user__not_in
customer_id
customer__in
customer__not_in
email
email__in
email__not_in
gateway
gateway__in
gateway__not_in
payment_key
payment_key__in
payment_key__not_in
date_created_query
date_completed_query
meta_query
The text was updated successfully, but these errors were encountered: