|
Prismic.io PHP kit
3.0.0
|
Public Member Functions | |
| __construct (Api $api, Form $form, array $data) | |
| getData () | |
| ref ($ref) | |
| after ($documentId) | |
| fetch () | |
| fetchLinks () | |
| pageSize ($pageSize) | |
| page ($page) | |
| orderings () | |
| submit () | |
| count () | |
| query () | |
| url () | |
| isCached () | |
Embodies an API call we are in the process of building. This gets started with Prismic\Api.form, then you can chain instance method calls to build your query, and the query gets launched with Prismic\SearchForm.submit.
For instance, here's how you query all of the repository: $result = $api->form('everything')->ref($ref)->submit()
And here's an example of a more complex query: $result = $api->form('products')->query('[[:d = any(document.tags, ["Featured"])]]')->pageSize(10)->page(2)->ref($ref)->submit()
Note that setting the ref is mandatory, or your submit call will fail.
Note also that SearchForm objects are immutable; the chainable methods all return new SearchForm objects.
Constructs a SearchForm object
| Prismic::Api | $api | the API object containing all the information to know where to query |
| Prismic::Form | $form | the REST form we're querying on in the API |
| array | $data | the parameters we're getting ready to submit |
| Prismic\SearchForm::after | ( | $documentId | ) |
Set the after parameter: the id of the document to start the results from (excluding that document).
| string | $documentId |
| Prismic\SearchForm::count | ( | ) |
Get the result count for this form
This uses a copy of the SearchForm with a page size of 1 (the smallest allowed) since all we care about is one of the returned non-result fields.
| RuntimeException |
| Prismic\SearchForm::fetch | ( | ) |
Set the fetch parameter: restrict the fields to retrieve for a document. You can pass in parameter an array of strings, or several strings.
| Prismic\SearchForm::fetchLinks | ( | ) |
Set the fetchLinks parameter: additional fields to retrieve for DocumentLink, You can pass in parameter an array of strings, or several strings.
| Prismic\SearchForm::getData | ( | ) |
Get the parameters we're about to submit.
| Prismic\SearchForm::isCached | ( | ) |
Checks if the results for this form are already cached
| Prismic\SearchForm::orderings | ( | ) |
Set the query's ordering, setting in what order the documents must be retrieved.
| Prismic\SearchForm::page | ( | $page | ) |
Set the query's page, for the pagination.
| int | $page |
| Prismic\SearchForm::pageSize | ( | $pageSize | ) |
Set the query's page size, for the pagination.
| int | $pageSize |
| Prismic\SearchForm::query | ( | ) |
Set the query's predicates themselves. You can pass a String representing a query as parameter, or one or multiple Predicates to build an "AND" query
| Prismic\SearchForm::ref | ( | $ref | ) |
Set the repository's ref.
| string | \Prismic\Ref | $ref | the ref we wish to query on, or its ID. |
| Prismic\SearchForm::submit | ( | ) |
Submit the current API call, and unmarshalls the result into PHP objects.
| RuntimeException |
| Prismic\SearchForm::url | ( | ) |
Get the URL for this form
1.8.12