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

[6.x] Query Builders #973

Merged
merged 36 commits into from
Feb 2, 2024
Merged

[6.x] Query Builders #973

merged 36 commits into from
Feb 2, 2024

Conversation

duncanmcclean
Copy link
Owner

@duncanmcclean duncanmcclean commented Jan 15, 2024

This pull request implements query builders for products, orders & customers.

This means we can use the same query across multiple repositories which was previously not possible as you had to implement the same-ish query two/three times depending on the repository in use.

The query builders extend the EntryQueryBuilder and EloquentQueryBuilder that are built into Statamic.

This PR shouldn't make much of a difference to end-developers, apart from the fact Product::all()/Customer::all()/Order::all() will now return Simple Commerce objects, rather than entries/Eloquent models.

This PR also improves the state of testing around the various product/order/customer repositories.

To Do

  • Implement query builders for orders
  • Implement query builders for customers
  • Implement query builders for products
  • Add tests around the various query builders
  • Refactor existing queries
  • Make sure id column in Eloquent queries actually queries whatever the model key is.
  • Resolve failing tests

duncanmcclean and others added 30 commits January 15, 2024 10:51
Since the "current repository" in this case would be the eloquent one so Customer::query() wouldn't pick up old customers.
@duncanmcclean duncanmcclean marked this pull request as ready for review February 2, 2024 23:36
# Conflicts:
#	src/Widgets/TopCustomers.php
@duncanmcclean duncanmcclean merged commit e3df162 into main Feb 2, 2024
10 checks passed
@duncanmcclean duncanmcclean deleted the query-builder branch February 2, 2024 23:50
Copy link

Released as part of v6.0.0.

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

Successfully merging this pull request may close these issues.

1 participant