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

[5.x] Add Form submissions query builder / facade #6455

Merged

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Aug 5, 2022

As mentioned here: #6446 (reply in thread)

This PR adds facade support for Form submissions so you can programatically retrieve submissions, eg.

Statamic\Facades\FormSubmission::whereForm('my_handle');
Statamic\Facades\FormSubmission::whereInForm(['my_handle', 'my_other_handle']);
Statamic\Facades\FormSubmission::query()->get();

The larger detail is that I've made a new stache store for form submissions, added a new repository, and added a submission query builder. The Form facade could and should probably be updated to use these going forward (?).

Still to do:

  • Write tests for submission repository
  • Write tests for submission query builder

A question for the core team is whether we should also provide a date() method on Submission::class, as it would be a very obvious use case that people would want to query for submissions between certain dates. It can be pulled from the file name anyway, so its just a case of making the date available to the class and therefore the query builder.

Edit: it always helps to look through the code properly - date() was already there, so I've made it possible to query by date by adding a Date index.

@ryanmitchell ryanmitchell marked this pull request as ready for review August 5, 2022 19:59
@jasonvarga
Copy link
Member

jasonvarga commented Aug 5, 2022

Live feed of Ryan working on the PR

So fast man, nice work.

@ryanmitchell
Copy link
Contributor Author

ryanmitchell commented Aug 5, 2022

Haha writing the code is quick. Making the tests work not so quick.

@ryanmitchell ryanmitchell changed the base branch from 3.3 to 4.x June 23, 2023 06:59
@ryanmitchell ryanmitchell changed the title Add Form submissions query builder / facade [4.x] Add Form submissions query builder / facade Jun 23, 2023
@duncanmcclean duncanmcclean changed the base branch from 4.x to master April 3, 2024 18:03
@duncanmcclean duncanmcclean changed the title [4.x] Add Form submissions query builder / facade [5.x] Add Form submissions query builder / facade Apr 3, 2024
@jasonvarga jasonvarga merged commit 22c831f into statamic:master Apr 5, 2024
16 checks passed
@ryanmitchell ryanmitchell deleted the feature/submissions-query-builder branch April 5, 2024 15:28
@ryanmitchell
Copy link
Contributor Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants