Closed pTinosq closed 1 year ago
I've found the following workaround for the time being:
$api->query(
Prismic\Predicates::at('document.type', 'project'),
[
'orderings' => '[my.project.date desc]',
'pageSize' => 100,
]
);
@pTinosq As stated in the Documentation of getByID the function takes the document ID as a parameter. Every document is automatically assigned a unique id when it is created.
I believe you might have confused the custom type with the document id here. Is that possible? Your workaround seems to be using the correct function for this type of query. You can find more on this here: https://github.com/prismicio-community/php-kit/blob/master/docs/02-query-the-api/02-query-predicate-reference.md
Has this helped you? Or do you still experience any problems?
If this is solved I would like to close this issue
Sorry for not replying, yeah all's well - thank you for clearing that up.
I'm trying to use the
GetByID
function with the ID"project"
to fetch all my projects as shown in the screenshots below, however, it's always returning NULL. When I try to input an ID that does not exist, it returns:This has led me to believe that it is finding the documents with the correct IDs, however, for some reason something's causing it to return NULL instead of the appropriate data.
Here is the code I am using: